note 77743 added to function.array-unique
| From: | xjazey at hotmail dot com | Date: | Tue, 11 Sep 2007 18:50:42 +0000 |
| Subject: | note 77743 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130378@lists.php.net to get a copy of this message | ||
This is a solution to remove duplicate values from an array
<?php
$array[0] = "Yellow";
$array[1] = "Green";
$array[2] = "Yellow";
$array[3] = "Blue";
$array[4] = "Yellow";
$array = array_keys(array_flip($array));
//$array will output Yellow Green Blue
?>
----
Server IP: 69.147.83.197
Probable Submitter: 90.229.197.13
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- https://master.php.net/note/edit/77743
Del: integrated -- https://master.php.net/note/delete/77743/integrated
Del: useless -- https://master.php.net/note/delete/77743/useless
Del: bad code -- https://master.php.net/note/delete/77743/bad+code
Del: spam -- https://master.php.net/note/delete/77743/spam
Del: non-english -- https://master.php.net/note/delete/77743/non-english
Del: in docs -- https://master.php.net/note/delete/77743/in+docs
Del: other reasons-- https://master.php.net/note/delete/77743
Reject -- https://master.php.net/note/reject/77743
Search -- https://master.php.net/manage/user-notes.php