Bug #18535: int to string comparison problem
| From: | marcin dot smieszek at pointblue dot com dot pl | Date: | Wed, 24 Jul 2002 10:31:18 +0000 |
| Subject: | Bug #18535: int to string comparison problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-15029@lists.php.net to get a copy of this message | ||
From: marcin.smieszek@pointblue.com.pl
Operating system: linux
PHP version: 4.2.1
PHP Bug Type: *General Issues
Bug description: int to string comparison problem
any variable, set, but set to 0 (but not "0") compared with any string
always returns true.
try
-------
if (0=="sth) {echo "problem";}
-------
or sth like this:
-------
$a=array("blahblah","1",1,"0",0);
foreach ($a as $value)
{
if ($value == "aaaa")
{
echo "<b>true</b><br>";
}
else
{
echo "false<br>";
}
}
------
--
Edit bug report at http://bugs.php.net/?id=18535&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18535&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18535&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18535&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18535&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18535&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18535&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18535&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18535&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18535&r=globals