|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1097 (0 == "test") is true?
Submitted: 1999-01-26 15:58 UTC Modified: 1999-01-26 16:23 UTC
From: eric at ipass dot net Assigned:
Status: Closed Package: Other
PHP Version: 3.0.6 OS: Solaris 2.5.1
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.
Bug Type:
From: eric at ipass dot net
New email:
PHP Version: OS:


 [1999-01-26 15:58 UTC] eric at ipass dot net
It appears that there is a problem between comparing 0 and a string.

  if (0 == "test")
    echo "True";
    echo "False";

will report that the test is true.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1999-01-26 16:23 UTC] rasmus
You are comparing an integer to a string here.  The inetger value of "test" is 0, hence the equality.  Try:
if( (string) 0 == "test")
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 13:01:28 2024 UTC