note 87615 added to function.array-unique
| From: | eligeske at osu1 dot php dot net | Date: | Fri, 12 Dec 2008 19:52:48 +0000 |
| Subject: | note 87615 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148097@lists.php.net to get a copy of this message | ||
Good Call on NOT using while() statement when using the array unique. This was returning blank
elements.
------------------------------------------------------------------
THIS RETURNED TWO BLANK ELEMENTS IN MY ARRAY:
$array = array_unique($array);
$i = 0;
while($i<count($array)+1){
echo $array[$i]."<br/>";
$i++;
}
-------------------------------------------------------------------
_______________________________________________
THIS DID NOT:
$array = array_unique($array);
foreach($array as $elem) {
echo "$elem <br/>";
}
__________________________________________________
----
Server IP: 64.71.164.2
Probable Submitter: 74.223.227.210
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- https://master.php.net/note/edit/87615
Del: integrated -- https://master.php.net/note/delete/87615/integrated
Del: useless -- https://master.php.net/note/delete/87615/useless
Del: bad code -- https://master.php.net/note/delete/87615/bad+code
Del: spam -- https://master.php.net/note/delete/87615/spam
Del: non-english -- https://master.php.net/note/delete/87615/non-english
Del: in docs -- https://master.php.net/note/delete/87615/in+docs
Del: other reasons-- https://master.php.net/note/delete/87615
Reject -- https://master.php.net/note/reject/87615
Search -- https://master.php.net/manage/user-notes.php