note 11752 added to Comparison Operators
| From: | nick_eby at hotmail dot com | Date: | Tue, 06 Mar 2001 01:07:54 +0000 |
| Subject: | note 11752 added to Comparison Operators | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11914@lists.php.net to get a copy of this message | ||
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.
http://www.php.net/manual/en/language.operators.comparison.php