note 14049 added to function.array-multisort.php
| From: | Johannes at php2 dot chek dot com | Date: | Sun, 15 Jul 2001 01:35:17 +0000 |
| Subject: | note 14049 added to function.array-multisort.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15397@lists.php.net to get a copy of this message | ||
To sort a multi-dimensional array according to a certain column, I use the follwing code:
// [x] = column to sort by (starts at 0)
foreach($array as $v) $s[] = $v[1];
// sort with array_multisort() options
array_multisort($s, SORT_ASC, $array);
http://www.php.net/manual/de/function.array-multisort.php