Question about "if" statement evaluating (0=="string") as TRUE

From: Date: Fri, 13 Dec 2002 19:27:03 +0000
Subject: Question about "if" statement evaluating (0=="string") as TRUE
Groups: php.general 
Request: Send a blank email to php-general+get-128197@lists.php.net to get a copy of this message
Erm... this seems a bit odd to me. I'm using PHPv4.2.2 on Win32 Is that becuase PHP is not properly comparing the numerical value with the string value? <? $no = 0; if ($no == "string") { print "this eval's to TRUE... since when is '0' == 'no' ?"; } if ("$no" == "string") { print "whereas this eval's to FALSE, as you'd expect"; } ?> -- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com --

« previous php.general (#128197) next »