RE: [PHP] Sorting problem
| From: | Daryl Meese | Date: | Fri, 27 Jun 2003 23:34:53 +0000 |
| Subject: | RE: [PHP] Sorting problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153224@lists.php.net to get a copy of this message | ||
Using the asort function will sort and keep the keys attached (there is also
arsort for sorting in reverse order with the keys attached). You may
already know that you will need to do something like:
while(list ($key, $value) = each($arrayname))
{
//$key is the array index, $value is the array value
body here
}
to see them in the correct order.
-----Original Message-----
From: Sparky Kopetzky [mailto:sparkyk@blackmesa-isp.net]
Sent: Friday, June 27, 2003 6:07 PM
To: PHP General
Subject: [PHP] Sorting problem
I need to sort an array and have the key 'follow' the value. I know I could
splice a string, sort it, then split it again but what a pain. Is there a
simpler way?
Robin E. Kopetzky
Black Mesa Computers/Internet Services
www.blackmesa-isp.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php