array sorting
Posted: Thu Oct 20, 2005 4:34 pm
original array:
I run asort() on this and get the following result
So that's cool. But now, when two or more keys have the same value, I'd like to sort those keys in alphabetical order, so the above array would look like this.
I need to maintain the same order of the numbers, for example 1s first then 3s, but rearrange the keys alphabetically.
I hope I explained that well. =/
Code: Select all
$array = array(B => 1, X => 3, A =>1, F => 3);Code: Select all
Array (
[B] => 1
[A] => 1
[X] => 3
[F] => 3
)Code: Select all
Array (
[A] => 1
[B] => 1
[F] => 3
[X] => 3
)I hope I explained that well. =/