array_unique wierdness

From: Date: Sun, 06 Apr 2003 03:26:50 +0000
Subject: array_unique wierdness
Groups: php.general 
Request: Send a blank email to php-general+get-142568@lists.php.net to get a copy of this message
I would like to remove duplicate array values, and I presume that array_unique should do this, but the results are not what I am expecting Anyone see this before: $dayarray=(9,22,22); $duparray = array_unique($dayarray); $darray = count($duparray); for($d=0;$d<$darray;$d++){ echo "$d: ".$duparray[$d]."<br>"; } ## returns: 0: 9 1: rather than 0: 9 1: 22 Is that what it is supposed to do? Does array_unique remove all instances of duplicate values? If so, is there a way to remove every instance but the first? Thanks, gr __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com

« previous php.general (#142568) next »