Re: array_diff() failures
| From: | Stig Venaas | Date: | Fri, 29 Dec 2000 00:37:22 +0000 |
| Subject: | Re: array_diff() failures | ||
| References: | 1 2 3 4 5 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-42496@lists.php.net to get a copy of this message | ||
On Thu, Dec 28, 2000 at 06:18:27PM -0600, Andrei Zmievski wrote:
> At 01:14 AM 12/29/00 +0100, Stig Venaas wrote:
> >I don't like how SORT_REGULAR works and the fact that one can get
> >segfaults on Solaris with sort() etc. but I guess it's a bit drastic
> >to change it. Perhaps avoid the systems qsort when using SORT_REGULAR?
> >What do you think?
>
> Have you tried using mergesort instead of qsort?
Just tried it, worked well. On Solaris 2.7 with mergesort I get from
$a = array("socket", "370", "99", "3d");
sort($a);
var_dump($a);
array(4) {
[0]=>
string(2) "99"
[1]=>
string(3) "370"
[2]=>
string(2) "3d"
[3]=>
string(6) "socket"
}
So it works. On systems were qsort() works, changing to mergeseort()
will change the order in some situations (I think), but people shouldn't
rely on that order anyway.
Stig