php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6818 Variable evaluating as 0 always matches against string
Submitted: 2000-09-20 18:57 UTC Modified: 2000-09-21 08:42 UTC
From: daniel at elektron dot se Assigned:
Status: Closed Package: Variables related
PHP Version: 4.0.2 OS: Linux/Redhat6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: daniel at elektron dot se
New email:
PHP Version: OS:

 

 [2000-09-20 18:57 UTC] daniel at elektron dot se
This piece of code describes my problem:

<?

$variable = 0;

if ($variable == "some_string")
{
  print "This must be a bug?! Variable set as $variable.\n\n<br>";
  $variable++;
  if ($variable != "some_string")
  {
    print "But with variable set as $variable it works fine.\n\n";
  }
}
else
{
  print "This works as I expected.\n\n";
}

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-21 08:42 UTC] sniper@php.net
Use === instead of ==

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC