RE: problems sorting an associative array...

From: Date: Tue, 14 Aug 2001 14:16:20 +0000
Subject: RE: problems sorting an associative array...
Groups: php.general 
Request: Send a blank email to php-general+get-62640@lists.php.net to get a copy of this message
Use arsort(), and while you're in the manual ( http://www.php.net/manual/en/ref.array.php <http://www.php.net/manual/en/ref.array.php> ) familiarise yourself with all the other sort functions (and array functions in general). There's some useful stuff there that you might not expect, and therefore not look for. Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html ---------- From: Ben Rigby [SMTP:ben@akimbodesign.com] Sent: 13 August 2001 20:21 To: php-general@lists.php.net Subject: problems sorting an associative array... hi. any help would be mych appreciated! i'm trying to sort an associative array, but when i do, the key is converted into a number (it should be a string). ie: $email_array["test@email.com"]=1; $email_array["test2@email.com"]=4; $email_array["test3@email.com"]=10; rsort ($email_array); i'm trying to sort by the value and then echo out the key and value together, but when i do, the key is always a number, rather than the email address that i wanted. any ideas?? thanks, ben

« previous php.general (#62640) next »