array diff with both values returned
| From: | blackwater dev | Date: | Fri, 06 May 2005 14:03:34 +0000 |
| Subject: | array diff with both values returned | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-214626@lists.php.net to get a copy of this message | ||
Hello,
Is there a good way to get the difference in two arrays and have both
values returned? I know I can use array_dif to see what is in one and
not the other but...I need it to work a bit differently.
I have:
$array1=array("name"=>"fred","gender"=>"m","phone="=>"555-5555");
$array2=array("name"=>"fred","gender"=>"f","phone="=>"555-5555");
I want to compare these two and have it return:
array("gender"=>array("m","f"));
I want it to return all of the differences with the key and then the
value from array 1 and 2.
How?
Thanks!