note 113889 added to function.array-unique
| From: | mostafatalebi at rocketmail dot com | Date: | Fri, 13 Dec 2013 14:38:16 +0000 |
| Subject: | note 113889 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197925@lists.php.net to get a copy of this message | ||
if you fine the need to get a sorted array without it preserving the keys, use this code which has
worked for me:
$array = array("hello", "fine", "good", "fine",
"hello", "bye");
$get_sorted_unique_array = array_values(array_unique($array));
// the above code returns an array which is both unique and sorted from zero.
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.array-unique.php
Edit -- https://master.php.net/note/edit/113889
Del: integrated -- https://master.php.net/note/delete/113889/integrated
Del: useless -- https://master.php.net/note/delete/113889/useless
Del: bad code -- https://master.php.net/note/delete/113889/bad+code
Del: spam -- https://master.php.net/note/delete/113889/spam
Del: non-english -- https://master.php.net/note/delete/113889/non-english
Del: in docs -- https://master.php.net/note/delete/113889/in+docs
Del: other reasons-- https://master.php.net/note/delete/113889
Reject -- https://master.php.net/note/reject/113889
Search -- https://master.php.net/manage/user-notes.php