PHP 4.0 Bug #6818 Updated: Variable evaluating as 0 always matches against string
| From: | Bug Database | Date: | Thu, 21 Sep 2000 12:42:06 +0000 |
| Subject: | PHP 4.0 Bug #6818 Updated: Variable evaluating as 0 always matches against string | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-33544@lists.php.net to get a copy of this message | ||
ID: 6818
Updated by: sniper
Reported By: daniel@elektron.se
Status: Closed
Bug Type: Variables related
Assigned To:
Comments:
Use === instead of ==
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-09-20 18:57:53] daniel@elektron.se
This piece of code describes my problem:
<?
$variable = 0;
if ($variable == "some_string")
{
print "This must be a bug?! Variable set as $variable.nn<br>";
$variable++;
if ($variable != "some_string")
{
print "But with variable set as $variable it works fine.nn";
}
}
else
{
print "This works as I expected.nn";
}
?>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6818