note 13926 modified in function.array-unique by vrana

From: Date: Tue, 17 Aug 2004 14:50:51 +0000
Subject: note 13926 modified in function.array-unique by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79791@lists.php.net to get a copy of this message
@lefeuvrenicolas Use the above mentioned combination with "array_values" - then it works. So do it like this: -------------------- <?php $truc = array("l810u00","l810u00","l810q00"); $machin = array_values(array_unique($truc)); for($i=0;$i < count($machin) ; $i++){ echo $machin[$i]."\n"; } ?> -------------------- But it is strange anyway ... --was-- @lefeuvrenicolas Use the above mentioned combination with "array_values" - then it works. So do it like this: -------------------- $truc = array("l810u00","l810u00","l810q00"); $machin = array_values(array_unique($truc)); for($i=0;$i < count($machin) ; $i++){ echo $machin[$i]."\n"; } -------------------- But it is strange anyway ... http://php.net/manual/en/function.array-unique.php

« previous php.notes (#79791) next »