PHP is famous for its type-juggling. I must admit it puzzles me, and I\'m having a hard time to find out basic logical/fundamental things in comparisons.
For example
After your correction of the second part of your question, I leave the answer to that part to the others. I just want to give the most surprising answer to the first part of your question, i.e., whether there is an example of the < and > operators being intransitive. Here it is.
These are all true:
"10" < "1a"
"1a" < "2"
"10" > "2"
If < were transitive ($a < $b ∧ $b < $c ⇒ $a < $c), the last line would be
"10" < "2"
but PHP tries to be kind (?!) and interpret strings as numbers whenever it can.
It turns out that, because of the above intransitivity, sort() can sort the same elements into a different order depending on their input order, even when no two elements are == (and no element is NAN). I pointed this out in a comment to sort(), the essence of which is:
sort(array("10", "1a", "2" )) => array("10", "1a", "2" )
sort(array("10", "2", "1a")) => array("1a", "2", "10")
sort(array("1a", "10", "2" )) => array("2", "10", "1a")
sort(array("1a", "2", "10")) => array("1a", "2", "10")
sort(array("2", "10", "1a")) => array("2", "10", "1a")
sort(array("2", "1a", "10")) => array("10", "1a", "2" )