Re: sorting multi-dimensional arrays
| From: | (Delbono) | Date: | Sat, 14 Apr 2001 09:50:57 +0000 |
| Subject: | Re: sorting multi-dimensional arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48524@lists.php.net to get a copy of this message | ||
mmmmhh, no, maybe the samplecode I posted it's not your case, sorry...
> I have a question about sorting multidimensional arrays. Here is my
problem:
>
> I have an 2-d array:
> $joke[1][rating]=10;
> $joke[2][rating]=20;
> $joke[3][rating]=15;
> ....
>
> I would like to sort the jokes into an array based on the rating from
highest
> to lowest. The end result would be something like this:
> Joke 2 : 20 points
> Joke 3: 15 points
> Joke 1: 10 points
>
> How do I accomplish this?
>
> I have tried fooling around with sort(), arsort(), and array_multisort(),
but
> I just can't get it. Thank you very much for your time.
>
> Shane
>