Re: Broken PHP4 Function
| From: | Andrei Zmievski | Date: | Tue, 05 Sep 2000 13:48:15 +0000 |
| Subject: | Re: Broken PHP4 Function | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-32158@lists.php.net to get a copy of this message | ||
On Mon, 04 Sep 2000, Ron Chmara wrote:
> The docs note that the keys are preserved.
>
> Thus:
>
> $orig_array = array("zero", "one", "one", "two");
>
> /* $orig_array is now the following:
> $orig_array[0] = "zero";
> $orig_array[1] = "one";
> $orig_array[2] = "one";
> $orig_array[3] = "two";
> */
>
> $new_array = array_unique($orig_array);
>
> /* $new_array is now the following:
> $new_array[0] = "zero";
> $new_array[1] = "one";
> $new_array[2] = "";
> $new_array[3] = "two";
> */
>
> The key of $orig_array[2] was preserved. I've added some clarification
> to the docs.
Eh, this is wrong, IMHO. The keys should not be preserved, the duplicate
entries should be deleted entirely. I'm going to put a fix in for this.
-Andrei
"Music expresses that which can not be said
and on which it is impossible to be silent."
-Victor Hugo