Hi,
I am not too much in array_unique() but played with array_diff() for a week
to implement array_diff_assoc() with no success so far but atm I am dreaming
the code of array_diff. I
saw that most of the code of array_diff() is in array_intersect() and
probably in array_unique() (yup it is like them).
The argument is sorted with zend_qsort() by value and nothing is known for
the key order in the
sorted array. Then the array is traversed from the beginning to the end and
when two or more sequental elements are equal everything starting the second
equal is wiped (in the result that is returned).



Best regards
Andrey Hristov


----- Original Message -----
From: "Sebastian Nohn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, September 03, 2002 10:39 AM
Subject: [PHP-QA] array_unique broken?


> bugs.php.net seems to be down, so i do it this way:
>
> ah. and 4.2.3RC2 and Compaq Tru64 are'nt mentioned on buildtest-submit
> on qa.php.net....
>
> When running array_unique over
>
> Array
> (
>     [0] => 1
>     [1] => 1
>     [2] => 1
>     [3] => 2
>     [4] => 2
>     [5] => 3
>     [6] => 9
>     [7] => 7
>     [8] => 4
>     [9] => 4
>     [10] => 4
>     [11] => 4
>     [12] => 4
>     [13] => 4
>     [14] => 4
>     [15] => 4
>     [16] => 5
>     [17] => 12
>     [18] => 12
> )
>
> PHP 4.2.3RC2 on Compaq Tru64 returns
>
> Array
> (
>     [0] => 1
>     [3] => 2
>     [5] => 3
>     [6] => 9
>     [7] => 7
>     [13] => 4
>     [16] => 5
>     [18] => 12
> )
>
> should'nt it be
>
> Array
> (
>     [0] => 1
>     [3] => 2
>     [5] => 3
>     [6] => 9
>     [7] => 7
>     [8] => 4
>     [16] => 5
>     [17] => 12
> )
>
> ?
>
> Regards, Sebastian Nohn
> --
> [EMAIL PROTECTED] - http://nohn.net/
>
> --
> PHP Quality Assurance Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to