In PHP (5.3.14), the following code returns
-1 > null
false. What is the reason behind this ?
PHP converts both sides to booleans when there is a null on one side.
The PHP manual section on Comparison Operators states that where the type of operand 1 is “bool or null”, or vice versa, it “converts both sides to bool,
FALSE < TRUE“.
Any number that has a non-zero value is considered to be truthy, though this may not be intuitive.
null -> 0).
3. If it is not the case that both Type(px) is String and Type(py) is String, then
a. Let nx be the result of calling ToNumber(px). Because px and py are primitive values evaluation order is not important.
b. Let ny be the result of calling ToNumber(py).