|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-11-10 16:34 UTC] venaas@php.net
[2016-01-22 09:37 UTC] andrius dot vs at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 02:00:01 2025 UTC |
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