note 87615 deleted from function.array-unique by danbrown
| From: | danbrown@php.net | Date: | Fri, 12 Dec 2008 19:56:47 +0000 |
| Subject: | note 87615 deleted from function.array-unique by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148099@lists.php.net to get a copy of this message | ||
Note Submitter: eli geske
----
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/>";
}
__________________________________________________