Re: sorting 2-D array by sub-array

From: Date: Fri, 21 Apr 2000 23:44:52 +0000
Subject: Re: sorting 2-D array by sub-array
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-18123@lists.php.net to get a copy of this message
At 01:55 PM 4/21/00 -0700, neurotik@neurotik.net 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

« previous php.dev (#18123) next »