Can you please explain how PHP execute this code and the result is true
?
var_dump( (false < -1) ); //bool(true)
Can you please explain how PHP execute this code and the result is true
?
var_dump( (false < -1) ); //bool(true)
For comparison PHP is casting values to same types.
If -1
is casted to boolen, that is true
, so if you compare false < true
then true
is correct value.
False is boolean type, and from PHP maunal:
Resource: http://php.net/bool