ID: 20319
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux RedHat
PHP Version: 4.2.2
New Comment:
In PHP '' == NULL, so I think it's correct that array_diff()
treats them the same. It removes all elements from the 1st
argument that are equal (normal PHP equality) to any element
in the other arguments.
Previous Comments:
------------------------------------------------------------------------
[2002-11-08 14:36:00] [EMAIL PROTECTED]
This work !!!
------------------------------------------------
$arr1 = array('Color' => '');
$arr2 = array('Img1' => 3, 'Img2' => 2, 'Color' => 'Yellow');
print_r(array_diff($arr1, $arr2));
Return : Array ( [Color] => )
This not work!!!
------------------------------------------------
$arr1 = array('Color' => '');
$arr2 = array('Img1' => NULL, 'Img2' => 2, 'Color' => 'Yellow');
print_r(array_diff($arr1, $arr2));
Return : Array ()
This work !!!
------------------------------------------------
$arr1 = array('Color' => 'Red');
$arr2 = array('Img1' => NULL, 'Img2' => 2, 'Color' => 'Yellow');
print_r(array_diff($arr1, $arr2));
When your array contain NULL value the array diff does not recognize
that Color is different. But if "Color" is not empty and different in
both array the return value is corect.
Sorry for my english !
Yanik
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20319&edit=1