Forum Moderators: coopster

Message Too Old, No Replies

help needed with uasort

order values alphabetically without reindexing

         

HelenDev

2:58 pm on Jul 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have an array which is something like this

$testarray = array(121 => 'January', 147 =>'February', 183 =>'March');

I need to order it alphabetically but without losing the index numbers, so I can't use sort(). I understand that you can use uasort with a user defined function to do the actual sorting, but I'm a bit stuck. Can anyone help?

joelgreen

5:50 pm on Jul 4, 2007 (gmt 0)

10+ Year Member



How about using asort?

[ua2.php.net...]

HelenDev

8:29 am on Jul 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Aha, thanks joel, that's much more simple! :)