note 79920 added to function.array-unique
| From: | php_array_unique | Date: | Wed, 19 Dec 2007 19:20:25 +0000 |
| Subject: | note 79920 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-133789@lists.php.net to get a copy of this message | ||
To clarify the note above Example #1, the function appears to cast the elements to strings for
comparison and then return the type of the first unique element encountered.
<?php
$input = array(0, 2, "2", 3, "9", 9);
$result = array_unique($input);
var_dump($result);
?>
array(4) {
[0]=>
int(0)
[1]=>
int(2)
[3]=>
int(3)
[4]=>
string(1) "9"
}
----
Server IP: 208.69.120.35
Probable Submitter: 69.230.47.58
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- https://master.php.net/note/edit/79920
Del: integrated -- https://master.php.net/note/delete/79920/integrated
Del: useless -- https://master.php.net/note/delete/79920/useless
Del: bad code -- https://master.php.net/note/delete/79920/bad+code
Del: spam -- https://master.php.net/note/delete/79920/spam
Del: non-english -- https://master.php.net/note/delete/79920/non-english
Del: in docs -- https://master.php.net/note/delete/79920/in+docs
Del: other reasons-- https://master.php.net/note/delete/79920
Reject -- https://master.php.net/note/reject/79920
Search -- https://master.php.net/manage/user-notes.php