note 70273 added to function.array-unique
| From: | geuis dot teses at gmail dot com | Date: | Mon, 09 Oct 2006 17:27:40 +0000 |
| Subject: | note 70273 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118322@lists.php.net to get a copy of this message | ||
Here's the shortest line of code I could find/create to remove all duplicate entries from an
array and then reindex the keys.
//$var is an array. This example its one-dimensional. Your most basic kind of array.
$var = array_values(array_unique($var));
----
Server IP: 64.71.164.2
Probable Submitter: 216.106.182.129
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- https://master.php.net/note/edit/70273
Del: integrated -- https://master.php.net/note/delete/70273/integrated
Del: useless -- https://master.php.net/note/delete/70273/useless
Del: bad code -- https://master.php.net/note/delete/70273/bad+code
Del: spam -- https://master.php.net/note/delete/70273/spam
Del: non-english -- https://master.php.net/note/delete/70273/non-english
Del: in docs -- https://master.php.net/note/delete/70273/in+docs
Del: other reasons-- https://master.php.net/note/delete/70273
Reject -- https://master.php.net/note/reject/70273
Search -- https://master.php.net/manage/user-notes.php