Re: Sorting an array
| From: | Monte Ohrt | Date: | Fri, 12 Jan 2001 17:13:02 +0000 |
| Subject: | Re: Sorting an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34263@lists.php.net to get a copy of this message | ||
http://www.php.net/manual/function.array-multisort.php
Matthew Brealey wrote:
>
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/