How to order this tricky PHP associative array?
I have this associative array:
Array (
[4] => 3
[2] => 4
[3] => 1
[6] => 1
[1] => 1
)
I need to order it by key with highest value, BUT I also need to keep the keys with the same values in their original order, so it needs to come out to:
Array (
[2] => 4
[4] => 3
[3] => 1
[6] => 1
[1] => 1
)
I cannot use arsort() because it rearranges the keys with the same value based on the key's numeric order, I'm really at a loss here! Any suggestions?