|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19008 == is wrong
Submitted: 2002-08-20 21:17 UTC Modified: 2002-08-20 21:32 UTC
From: six at t0x dot net Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.2.2 OS: linux 2.4.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: six at t0x dot net
New email:
PHP Version: OS:


 [2002-08-20 21:17 UTC] six at t0x dot net
What do you think of the result of the little script below ??

shouldn't == return false on this one ?

t0x:~# php -v
t0x:~# php
if ($a=="*") echo "argh\n";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-20 21:32 UTC]
Which is why you should use === if you want to compare different types like that.  You are comparing an integer to a string, so PHP has to one to the other.  In this case it converted "*" to an integer which ends up being 0 and 0==0 so that is the result you get.  Do your own conversion first to force it to convert the right one, or use === to compare both type and value.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 18:01:36 2024 UTC