Bug #54625 [Opn->Bgs]: string is equals a 0 !?
| From: | johannes@php.net | Date: | Thu, 28 Apr 2011 15:39:53 +0000 |
| Subject: | Bug #54625 [Opn->Bgs]: string is equals a 0 !? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160423@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54625&edit=1
ID: 54625
Updated by: johannes@php.net
Reported by: bernardo at datamex dot com dot br
Summary: string is equals a 0 !?
-Status: Open
+Status: Bogus
Type: Bug
Package: Unknown/Other Function
Operating System: Windows and Freebsd
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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
See http://php.net/manual/en/types.comparisons.php
Previous Comments:
------------------------------------------------------------------------
[2011-04-28 17:32:28] bernardo at datamex dot com dot br
Description:
------------
// tested both in
// in windows 7 - php 5.2.12.12
// in freebsd 7 - php 5.3.3
// because 'e' equals zero, zero is false and false is not equal to 'e'
var_dump(0 == 'e'); // true
var_dump(false == 0); // true
var_dump(false == 'e'); // false
echo '<hr>';
// this means that when we compare int to string will always be equal?
var_dump(0 == "e"); // true
var_dump(0 == "Bernardo"); // true
what is the meaning of this? I think it should not return true.
Test script:
---------------
<?
var_dump(0 == 'e'); // true
?>
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54625&edit=1