Re: [PHP-DEV] sorting 2-D array by sub-array From: Andrei Zmievski (andrei <email protected>)
Date: 04/21/00

At 01:55 PM 4/21/00 -0700, neurotik <email protected> wrote:
>I'm not sure if what I need to do is possible or not.. I have a
>two-dimensional array. I need to apply the rsort() function to the nested
>array ($votes) in order for the array to be sorted by largest number to
>smallest keeping in mind that both, $names and $votes need to stay in
>relation in order for the amount of votes to be assigned to the proper
>name. $totals[$names[$votes]]

Use usort() and define your own comparison function.

-Andrei

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>