note 6561 modified in array_flip by ronabop
| From: | ronabop@php.net | Date: | Wed, 18 Oct 2000 04:24:47 +0000 |
| Subject: | note 6561 modified in array_flip by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6615@lists.php.net to get a copy of this message | ||
To uniquify a list, this is better
$hash = array_flip($array);
$array = array_keys($hash);
Otherwise: If you just do two array_flip operations, you end up with a sparse array (the elements in
the old arrays that were duplicates are left as gaps).
http://www.php.net/manual/function.array-flip.php