On Tue, 3 Sep 2002, Andrey Hristov wrote:
AH>>> 
AH>>> Hi,
AH>>> I am not too much in array_unique() but played with array_diff() for a week
AH>>> to implement array_diff_assoc() with no success so far but atm I am dreaming
AH>>> the code of array_diff. I
AH>>> saw that most of the code of array_diff() is in array_intersect() and
AH>>> probably in array_unique() (yup it is like them).
AH>>> The argument is sorted with zend_qsort() by value and nothing is known for
AH>>> the key order in the
AH>>> sorted array.

If (zend_)qsort is the basis for all sorting operations, regarding arrays, isn't
it better then to use a stable sorting routine (I don't know if zend_qsort makes
qsort stable, so if it does, ignore this).

>From my personal experience, I expect array_unique, to display more or less the
same functionality as the SQL GROUP construct, leaving the first element of dupli-
cates in tact.

On BSD you have mergesort() but I don't know how portable that is.


-- 


Melvyn.


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to