Re: removing duplicate entries from array
| From: | Andreas Pour | Date: | Fri, 21 Jul 2000 10:16:03 +0000 |
| Subject: | Re: removing duplicate entries from array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7541@lists.php.net to get a copy of this message | ||
Hi,
An even faster way, if you use the latest php, is array_unique(), one of
the undocumented functions you can read briefly about at
http://www.zugeschaut-und-mitgebaut.de/php/function.array_unique.html.
Ciao,
Andreas
Teodor Cimpoesu wrote:
>
> Hi Steven!
> On Fri, 21 Jul 2000, Steven Glogger wrote:
>
> > is there a quick way to remove all double entries from a array?
> if you asked for a function nope,
> you can do smth. ~
> $a = array (1,1,2,2,3,3);
> $b = array ();
> foreach ($a as $k) {
> !in_array ($k,$b) && $b[] = $k;
> }
> $a = $b;
>
> -- teodor
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net