note 33177 deleted from function.array-multisort by aidan
| From: | aidan@php.net | Date: | Sun, 03 Oct 2004 10:45:08 +0000 |
| Subject: | note 33177 deleted from function.array-multisort by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77796@lists.php.net to get a copy of this message | ||
Note Submitter: WimX&planet.nl
----
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.