Re: Sorting Multidimensional Associative arrays

From: Date: Mon, 26 Jun 2000 22:35:44 +0000
Subject: Re: Sorting Multidimensional Associative arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3228@lists.php.net to get a copy of this message
Look at the attached file from Richard Lynch. The last example works exactly the way you need. Nicola ----- Original Message ----- From: "Alex V." <alex@quad.com.ar> To: <php-general@lists.php.net> Sent: Tuesday, June 27, 2000 12:06 AM Subject: [PHP-GENERAL] Sorting Multidimensional Associative arrays > I'm trying to sort a multidimensional asociative array. > > The array looks like this: > > $r[$user]['skill'] > $r[$user]['age'] > $r[$user]['experience'] > > is it possible to sort this array in such way that the first key of it > (user) is the user with the highest age number and the last user is the one > with lowest age number? That is.. an descending sorting of users by their > age. > > If it were a mysql database. what i want is something like "SELECT user FROM > table ORDER BY skill DESC" but since it's an array and not a sql ... I have > no clue :) > > You may ask.. why dont I have that info at an sql so I could make a simple > query... well, I might have some reasons for not doing it. but that's not > the point. so please if anyone knows how to sort the array.. any examples > would be really helpfully :)) > > Thanks in advance > > Alex. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#3228) next »