Re: [PHP-DEV] array_diff() failures From: Stig Venaas (Stig.Venaas <email protected>)
Date: 12/28/00

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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>