note 34826 deleted from function.ksort by didou

From: Date: Fri, 08 Aug 2003 21:12:30 +0000
Subject: note 34826 deleted from function.ksort by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53675@lists.php.net to get a copy of this message
Note Submitter: matt@driftingembers.com ---- I'm not sure if this is the correct way of removing duplicate entries in an array, but ksort will do it: $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple", "c"=>"apple"); ksort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } Will print "a = orange b = banana c = apple d = lemon"

« previous php.notes (#53675) next »