Re: Sorting multidim array and keeping associations
| From: | Peter Lauri | Date: | Wed, 17 Nov 2004 18:16:30 +0000 |
| Subject: | Re: Sorting multidim array and keeping associations | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202332@lists.php.net to get a copy of this message | ||
I have tried to figure it out how to use it with those, but I can not find a
solution.
- Best Of Times
/Peter
"Sebastian Mendel" <lists@sebastianmendel.de> skrev i meddelandet
news:20041117163505.11031.qmail@pb1.pair.com...
> Peter Lauri wrote:
> > Best groupmember,
> >
> > I have an multidim array that looks something like this:
> >
> > [40] => [1]=32, [2]=>55, ["total"]=>87
> > [22] => [8]=2, [7]=>105, ["total"]=>107
> > [142] => [2]=3, [7]=>8, ["total"]=>11
> >
> > I want to sort this array according to the "total" and still keep the
acc.
> > with the basekey. I know I can easily do this by writing an function
myself.
> > But are there any built in functions for this? I have looked at usort,
> > uksort and more, but they do not seem to solve my problem.
>
> uksort() or array_multisort() should do fine
>
> --
> Sebastian Mendel
>
> www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com
> www.sf.net/projects/phpdatetime www.sf.net/projects/phptimesheet