note 100360 added to function.array-unique
| From: | simon at osu1 dot php dot net | Date: | Mon, 11 Oct 2010 12:01:55 +0000 |
| Subject: | note 100360 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173128@lists.php.net to get a copy of this message | ||
if you want to close the gaps into the keys after using array_unique() you can use array_values()
afterwards. Example:
<?php
a = array("one", "two", "two", "three")
a = array_unique(a);
/* will lead to:
a[0] = "one"
a[1] = "two"
a[3] = "three"
*/
a = array_values(a);
/* Now we've got:
a[0] = "one"
a[1] = "two"
a[2] = "three"
*/
?>
----
Server IP: 217.160.235.204
Probable Submitter: 192.77.114.200
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- https://master.php.net/note/edit/100360
Del: integrated -- https://master.php.net/note/delete/100360/integrated
Del: useless -- https://master.php.net/note/delete/100360/useless
Del: bad code -- https://master.php.net/note/delete/100360/bad+code
Del: spam -- https://master.php.net/note/delete/100360/spam
Del: non-english -- https://master.php.net/note/delete/100360/non-english
Del: in docs -- https://master.php.net/note/delete/100360/in+docs
Del: other reasons-- https://master.php.net/note/delete/100360
Reject -- https://master.php.net/note/reject/100360
Search -- https://master.php.net/manage/user-notes.php