Created
December 18, 2013 16:29
-
-
Save pmgupte/8025297 to your computer and use it in GitHub Desktop.
PHP comparison is so inconsistent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| var_dump(null == 0); // evaluates to true | |
| var_dump(null < -1); // this also evaluates to true | |
| // so, how can some predefined value be equal to 0 as well as be less than -1? | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
null evaluates to "0" when you compare to numeric values.