Bug #44990 [Com]: array('word')==array(0) -- true
| From: | radamanf at gmail dot com | Date: | Thu, 14 Feb 2013 16:59:13 +0000 |
| Subject: | Bug #44990 [Com]: array('word')==array(0) -- true | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176629@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=44990&edit=1
ID: 44990
Comment by: radamanf at gmail dot com
Reported by: design at apostolstudio dot com
Summary: array('word')==array(0) -- true
Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
Comparison === needed ONLY if, during type conversion, we got same values, so String compare to
Integer should be compared using Integer converted to string and check if they are equal.
So if String is '' and Int is 0
or '1' == 1
'2' == 2
.. etc. only in this cases === is necessary to tell VARIABLE TYPE difference.
It's so obvious, why I'm explaining all this to you ?! You should know this better than
me! Please fix this BUG
Previous Comments:
------------------------------------------------------------------------
[2008-05-14 02:58:01] design at apostolstudio dot com
Thanks for explanations.
------------------------------------------------------------------------
[2008-05-14 02:39:53] cellog@php.net
use ===
'word' is converted to an integer for the comparison, and thus 0 == 0.
try this code:
if(array('word')===array(0)) echo "ERROR";
------------------------------------------------------------------------
[2008-05-14 02:27:10] design at apostolstudio dot com
Description:
------------
array('word')==array(0) -- return true
Reproduce code:
---------------
if(array('word')==array(0)) echo "ERROR";
Actual result:
--------------
ERROR
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=44990&edit=1