Re: Sorting multidim array and keeping associations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter Lauri wrote:

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

I have tried to figure it out how to use it with those, but I can not find a solution.

and whats the problem? did you tried uksort() ?

what did you tried? post the code, and someone will take a look and give a hint!

sorry, but if you want a complete solution, go hire a php-programmer!

--
Sebastian Mendel

www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com
www.sf.net/projects/phpdatetime        www.sf.net/projects/phptimesheet

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux