RE: [PHP] Sorting an array of arrays....
| From: | Darren Gamble | Date: | Thu, 14 Feb 2002 16:34:39 +0000 |
| Subject: | RE: [PHP] Sorting an array of arrays.... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-84756@lists.php.net to get a copy of this message | ||
Good day,
uasort() should do what you need.
http://www.php.net/manual/en/function.uasort.php
There's an example for the usort function that does something similar to
what you want, in fact.
============================
Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948
-----Original Message-----
From: Fifield, Mike [mailto:Mike.Fifield@schwab.com]
Sent: Thursday, February 14, 2002 9:26 AM
To: php-general@lists.php.net
Subject: [PHP] Sorting an array of arrays....
What I am trying to do is sort a array of arrays but I want to sort by one
of the pieces of data stored in the arrays inside the array. For example;
$data[blue] = array("name", "age", "time", "3");
$data[green] = array("name", "age", "time", "7");
$data[red] = array("name", "age", "time", "6");
$data[yellow] = array("name", "age", "time", "2");
$data[white] = array("name", "age", "time", "1");
$data[black] = array("name", "age", "time", "9");
I want to be able to sort this array of arrays by the very last element, the
numbers.
Mike Fifield
Charles Schwab & Co, Inc.
WARNING: All e-mail sent to or from this address will be received by the
Charles Schwab corporate e-mail system and is subject to archival and review
by someone other than the recipient.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php