----- Original Message ----- From: "Stig Venaas" <[EMAIL PROTECTED]> To: "Andrey Hristov" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, September 03, 2002 11:43 AM Subject: Re: [PHP-DEV] Re: [PHP-QA] Re: [PHP-DEV] Re: [PHP-QA] array_unique broken?
.... > They are right for current releases, but what is not said is that it's > not obvious what the order will be after sorting, so it's not really > useful to know that the first key for every value is kept. I would say > that the order now is undefined. I think it will be better with the new > code when there is a defined and concistent ordering, and I would say > it's backwards compatible since previously it wasn't defined. > .... > In one way it might make sense to use the systems native sorting functions > when available, they are probably faster. OTOH it might lead to different > sorting on different platforms which is why I say that which key for a > value array_unique() keeps is undefined (except for new implementation). > I would expect mergesort functions to always be stable though, so it might > be safe to use native implementations. > 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). Andrey -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php