我有一個多維相關數組,我嘗試按字母順序和按大小進行排序。檢查我現在正在獲取的例子,但現在我想按字母順序排序鍵「ACC,ABB,AAB」,如果有意義的話,不用編輯大小排序。按字母順序排列PHP關聯數組並按大小排序
arsort($myarray);
// Returns an array sorted by its value size from biggest to smallest but need to to also sort it keys alpabetically without amongest keys that have the same size.
$myArray = Array ( <--- Arrange this alphabetically and by size
[AAA] => Array (is 1st
[1] => 1
[2] => 1
[3] => 1
[4] => 1
)
[ACC] => Array (should be 3rd
[1] => 1
[2] => 1
)
[ABB] => Array (should be 2nd
[1] => 1
[2] => 1
)
[AAB] => Array (should be 1st
[1] => 1
[2] => 1
)
[AA] => Array (is 1st
[1] => 1
)
[AB] => Array (is 2nd
[1] => 1
)
)
通過此鏈接http://stackoverflow.com/questions/4151155/sorting-a-multi-dimensional-array-by-the-size-of-its-sub-array按大小排序 – zamil