note 8363 added to array_unique
| From: | rredmon at spiggle dot com | Date: | Thu, 07 Sep 2000 20:49:05 +0000 |
| Subject: | note 8363 added to array_unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4448@lists.php.net to get a copy of this message | ||
bug in array_unique, ran this code using version 4.0.1pl2:
<?
$tarray =
array('General','Social','Social','Social','Social','Social','Sports','Sports','Sports','Sports','Topic','Topic','Topic','Topic','Topic','Topic','Misc','Misc','Misc','Misc','Misc','Misc','Misc','Misc');
echo "\n*".join(':',$tarray)."*\n";
$tarray = array_unique($tarray);
echo "\n*".join(':',$tarray)."*\n";
echo "\nsize=".sizeof($tarray)."\n";
for ($r = 0; $r < sizeof($tarray); $r++)
echo "\n*".$tarray[$r]."*";
echo "\n*".join(':',$tarray)."*\n";
echo "\n";
?>
got this output
*General:Social:Social:Social:Social:Social:Sports:Sports:Sports:Sports:Topic:Topic:Topic:Topic:Topic:Topic:Misc:Misc:Misc:Misc:Misc:Misc:Misc:Misc*
*General:Social:Sports:Topic:Misc*
size=5
*General*
*Social*
**
**
**
*General:Social:Sports:Topic:Misc*
WHAT Gives here?, Why does join("",$tarray) give the expected output while $tarray[2] does
not?
http://www.php.net/manual/function.array-unique.php