note 34826 added to function.ksort

From: Date: Thu, 07 Aug 2003 18:57:09 +0000
Subject: note 34826 added to function.ksort
Groups: php.notes 
Request: Send a blank email to php-notes+get-53592@lists.php.net to get a copy of this message
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" ---- Manual Page -- http://www.php.net/manual/en/function.ksort.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34826 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34826&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34826&report=yes

« previous php.notes (#53592) next »