我需要对具有这种形式的数组进行排序:
Array
(
[18] => 9
[14] => 4
[53] => 9
[10749] => 4
[28] => 9
[12] => 6
[878] => 7
[35] => 8
[10769] => 1
[9648] => 1
[10751] => 1
[27] => 1
[80] => 3
)
该arsort
功能给了我:
Array
(
[53] => 9
[28] => 9
[18] => 9
[35] => 8
[878] => 7
[12] => 6
[14] => 4
[10749] => 4
[80] => 3
[27] => 1
[10769] => 1
[9648] => 1
[10751] => 1
)
这很好,但问题是当值相同时,我想让它们按它们排序keys
,这可能吗?所以我会得到:
Array
(
[18] => 9
[28] => 9
[53] => 9
[35] => 8
[878] => 7
[12] => 6
[14] => 4
[10749] => 4
[80] => 3
[27] => 1
[9648] => 1
[10751] => 1
[10769] => 1
)
谁能告诉我该怎么做?