#26071 [Bgs]: Number 0 is equal to any string.
| From: | flood87 at hot dot ee | Date: | Sat, 01 Nov 2003 20:33:47 +0000 |
| Subject: | #26071 [Bgs]: Number 0 is equal to any string. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-49822@lists.php.net to get a copy of this message | ||
ID: 26071
User updated by: flood87 at hot dot ee
Reported By: flood87 at hot dot ee
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Windows XP
PHP Version: 5.0.0b1 (beta1)
New Comment:
Oh, sorry. I did look through the documentation, but didn't find the
needed page. For those, who have the same problem, the needed page is
http://www.php.net/manual/en/types.comparisons.php
.
Thank you.
Previous Comments:
------------------------------------------------------------------------
[2003-11-01 15:17:04] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Use ===
------------------------------------------------------------------------
[2003-11-01 15:10:52] flood87 at hot dot ee
Description:
------------
The bug takes place in versions of php from 4 to 5. Because of some
reasons number 0 is equated with any string. The equal operator (==) is
used. The problem is well illustrated with the "Reproduce code".
Reproduce code:
---------------
$i = 0;
$b = $i == "str";
var_dump($b);
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26071&edit=1