note 33177 added to function.array-multisort

From: Date: Wed, 18 Jun 2003 10:28:41 +0000
Subject: note 33177 added to function.array-multisort
Groups: php.notes 
Request: Send a blank email to php-notes+get-50569@lists.php.net to get a copy of this message
If you want to sort a multidimensional array on its first field you can just sort the arrays: $salaries=array(array("8.000", "John"), array("5.000", "Peter"), array("9.000", "Bill")); If you do "sort($salaries)", the result will be: ("5.000", "Peter") ("8.000", "John") ("9.000", "Bill") A little warning about sorting with MySQL: MySQL sorts by default case-insensitive. ---- Manual Page -- http://www.php.net/manual/en/function.array-multisort.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33177 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33177&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33177&report=yes

« previous php.notes (#50569) next »