#39811 [Opn->Bgs]: array_diff "compare with 2" bug
| From: | tony2001@php.net | Date: | Wed, 13 Dec 2006 10:06:41 +0000 |
| Subject: | #39811 [Opn->Bgs]: array_diff "compare with 2" bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-106291@lists.php.net to get a copy of this message | ||
ID: 39811
Updated by: tony2001@php.net
Reported By: wishm at bk dot ru
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: win32
PHP Version: 4.4.4
New Comment:
http://php.net/array_diff
array_diff() returns an array containing **all the values of array1
that are not present in any of the other arguments*.
In your case all values of $a are present in $b.
Previous Comments:
------------------------------------------------------------------------
[2006-12-13 07:49:54] wishm at bk dot ru
Description:
------------
array_diff() function fails on comparing any array element with 2, when
another pair of elements are both set to 2. Fails with that settings
only.
Reproduce code:
---------------
<?php
$a = array("2","2");
$b = array("2","any_symbols_here");
// same thing on $b = array("any_symbols_here","2");
print_r(array_diff($a,$b));
?>
Expected result:
----------------
Array ( [1] => 2 )
// second elements are not equal so function should return that element
from $a array
Actual result:
--------------
Array ( )
//empty array - function failed
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39811&edit=1