Re: Re: array_unique broken?

From: Date: Tue, 03 Sep 2002 08:53:50 +0000
Subject: Re: Re: array_unique broken?
References: 1 2 3 4 5 6  Groups: php.dev 
Request: Send a blank email to php-dev+get-87861@lists.php.net to get a copy of this message
On Tue, Sep 03, 2002 at 11:47:58AM +0300, Andrey Hristov wrote: > IMO that's good idea to have keys ordered too. All my nightmares with > array_diff() came from that > the key order is undefined and I tried all kind of tricks (traversing like > in a marathon forward and backwards to > find are there couples [k,v] that are identical). Note that the sorting in array_unique() is just for internal reasons, it did until recently determine which key was returned for a value though. I think for array_diff() and array_intersect() the ordering should be as in the first argument, current implementations do that. I don't think any sorting should be done except internally and that is just to make things efficient. If we need something like array_diff_associative() etc those should also do sorting internally for efficiency (I see no other way), and not rely on the unsorted output from array_diff() etc. Stig

« previous php.dev (#87861) next »