ID:               46640
 Updated by:       [EMAIL PROTECTED]
 Reported By:      realbaziak at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Gentoo Linux
 PHP Version:      5.2.6
 New Comment:

Find out about ===


Previous Comments:
------------------------------------------------------------------------

[2008-11-21 17:10:34] realbaziak at gmail dot com

Description:
------------
Equality operator returns true, though arrays are different.
Is it a bug or feature? :)

Thanks.

Reproduce code:
---------------
$a =  array(0 => "something");
$b1 = array(0 => "another");
$b2 = array(0 => "0");
$b3 = array(0 => null);
$b4 = array(0 => 0);

$a2 = array(0 => "two", 1 => "elements");
$b5 = array(0 => 0, 1 => 0);

var_dump($a == $b1); // bool(false)
var_dump($a == $b2); // bool(false)
var_dump($a == $b3); // bool(false)
var_dump($a == $b4); // bool(true) -- why array(0 => "something") 
                     // equals to array(0 => 0)?

var_dump($a2 == $b5); // bool(true) -- it seems there are some
regularity

Expected result:
----------------
always bool(false)

Actual result:
--------------
bool(true) on something like 
array(0 => "one", 1 => "two") == array(0 => 0, 1 => 0)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46640&edit=1

Reply via email to