php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4865 Problem with != and 0
Submitted: 2000-06-07 14:43 UTC Modified: 2000-06-12 18:04 UTC
From: lwillis at plus dot net dot uk Assigned:
Status: Closed Package: Other
PHP Version: 4.0.0 Release OS: Linux 2.2.14
Private report: No CVE-ID: None
 [2000-06-07 14:43 UTC] lwillis at plus dot net dot uk
The following script produces unexpected results:

<?

$tmp = 0;
if ($tmp != "JBIJI") {
    echo "is true";
} else {
    echo "is false";
}

?>

This produces "is false" as output where I would have thought that since the value of $tmp isn't "JBIJI" the expression "$tmp != 'JBIJI'" should evaluate true??

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-12 17:53 UTC] lwillis at plus dot net dot uk
Apparently this is a 'usage/documentation' issue and not a PHP 'bug' per se. I'm happy for this to be closed now.
 [2000-06-12 18:02 UTC] stas at cvs dot php dot net
closed per user request
 [2000-06-12 18:04 UTC] stas at cvs dot php dot net
closed this time
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 08 18:03:46 2023 UTC