A Non-transitive Comparison¶
Sometimes I truly believe that I have grasped all of the weird semantics of PHP, and then I discover something so simple that breaks an assumption I had about the language.
I knew that NAN == X can return true.
I knew that the comparison operators are not transitive.
I obviously knew that "0" == 0 and "0" == false return true.
And yet it was foolish of me to believe that all instance of X == false would give the same answer as X == null.
As TIL "0" == null is false.
See Also¶
Non-transitive comparison [Try me]