Re: sorting array question

From: Date: Wed, 26 Jul 2006 14:38:49 +0000
Subject: Re: sorting array question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-239816@lists.php.net to get a copy of this message
hi guys, thanks for the replies! yes Melanie, you were correct the last example (i had an old version of the manual). seemed to do the trick =) Thanks to john as well for the reply. Angelo Melanie Maddix wrote:
[snip] So they way I want to sort these rows is by total, totalPaid, totalUnpaid all descending. Output should be: partnerID | partnerName | total | totalPaid | totalUnpaid
5                  berty               30    12                18
7                  sarah               19    12                7        1                  marc               12      5                7
I have looked at the manual and found uasort and array_multisort, but these don't seem to be appropriate unless Im missing something but the examples found are very vague. If anyone can help that would be great, Thanks in advance Angelo [/snip] Hi Angelo, Take a look at Example 3 under array_multisort, the one that sorts by volume and edition. You first build arrays of the columns you want to sort by, then pass them as an argument to array_multisort, along with your original array. Melanie
-- ------------------------------------------------------------------------ Angelo Zanetti Systems developer ------------------------------------------------------------------------ *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:* +27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* angelo@zlogic.co.za <mailto:jerry@zlogic.co.za>

« previous php.general (#239816) next »