Sorting an array
| From: | Matthew Brealey | Date: | Fri, 12 Jan 2001 17:03:48 +0000 |
| Subject: | Sorting an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-34260@lists.php.net to get a copy of this message | ||
I have a 2-d array:
$list[$ctr]["username"]
$list[$ctr]["county"]
$list[$ctr]["age"]
$list[$ctr]["id"]
$list[$ctr]["days"]
I need to sort by days, which is an integer. What function should I use?
E.g.,
$list[0][mark]
$list[0][somewhere]
$list[0][12]
$list[0][1]
$list[0][200]
$list[1][andy]
$list[1][somewherefurther]
$list[1][18]
$list[1][2]
$list[1][100]
$list[2][sam]
$list[2][somewhereelse]
$list[2][15]
$list[2][3]
$list[2][150]
should sort to:
$list[0][mark]
$list[0][somewhere]
$list[0][12]
$list[0][1]
$list[0][100]
$list[1][andy]
$list[1][somewherefurther]
$list[1][18]
$list[1][2]
$list[1][150]
$list[2][sam]
$list[2][somewhereelse]
$list[2][15]
$list[2][3]
$list[2][150]
-- Random (non-anti-Microsoft) fortune