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:[EMAIL PROTECTED]
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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to