Re: wanted: array_diff for more than values

From: Date: Sat, 09 Nov 2002 00:22:43 +0000
Subject: Re: wanted: array_diff for more than values
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-123518@lists.php.net to get a copy of this message
yes, i'm aware of that. what i'm asking is, is there a PHP function (or a one-liner composite of several functions?) that can do an array_diff while also checking the key=>value mapping. "Baroiller Pierre-Emmanuel" <baroiller@daoditu.com> wrote in message news:20021109001822.33085.qmail@pb1.pair.com... > array_diff check value, not keys.. > > "Nick Eby" <nick_eby@bonzidev.com> a écrit dans le message de news: > 20021108230458.87895.qmail@pb1.pair.com... > > example: > > $arr1 = array("color" => "red", "flavor" => > > "cherry"); > > $arr2 = array("color" => "cherry", "flavor" => > > "red"); > > print_r(array_diff($arr1, $arr2)); > > > > those 2 arrays are different, but array_diff doesn't know it since it > > doesn't compare values at particular keys, just values in general. i want > a > > function that knows that those 2 arrays are different; that the values for > > both color and flavor changed, and gives me back an array that looks > exactly > > like $arr2. although it would take about five minutes to write such a > > function, i'm wondering, does one already exist and i just can't find it > in > > the manual? thanks > > /nick > > > > > >

« previous php.general (#123518) next »