note 11752 deleted from language.operators.comparison by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 00:15:18 +0000 |
| Subject: | note 11752 deleted from language.operators.comparison by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58424@lists.php.net to get a copy of this message | ||
Note Submitter: nick_eby@hotmail.com
----
be very, very careful when testing for equality with strings and integers, or you will be burned.
in the example below, all echoes print 1 except for the last.
echo (0 == false && false==0);
echo (''==false && ""==false && false=='' &&
false=="");
echo (0=='' && 0=="" && ''==0 &&
""==0);
echo (0 == "0" && "0" == 0);
echo ('0' == '' || "0" == "");
hmm... a==b, b==c, a!=c.