note 8363 deleted from array_unique by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Thu, 07 Sep 2000 22:00:53 +0000 |
| Subject: | note 8363 deleted from array_unique by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4462@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?