note 90227 deleted from function.natcasesort by danbrown

From: Date: Sat, 11 Apr 2009 15:13:55 +0000
Subject: note 90227 deleted from function.natcasesort by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153086@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- The code by claude at schlesser dot lu is quite awkward. Here is a much simpler solution to sort atwo dimensional array by its keys: public static function SortByKey($Array) { $Keys = array_keys ($Array); $Values = array_values($Array); natcasesort($Keys); $Out = array(); foreach($Keys as $OrgPos => $Key) { $Out[$Key] = $Values[$OrgPos]; } return $Out; }

« previous php.notes (#153086) next »