2
我有一個數組,看起來像這樣:排序多維數組?
Array ([0] => Array ([filters] => Array ([filter_1] => 1
[filter_2] => 1
[filter_3] => 1
[filter_4] => 1
[filter_5] => 1
[filter_6] => 1),
[count] => 2),
[1] => Array ([filters] => Array ([filter_1] => 1
[filter_2] => 1
[filter_3] => 1
[filter_4] => 1
[filter_5] => 1
[filter_6] => 1),
[count] => 34)
[2] => Array ([filters] => Array ([filter_1] => 1
[filter_2] => 1
[filter_3] => 1
[filter_4] => 1
[filter_5] => 1
[filter_6] => 1),
[count] => 7)
是否有可能通過在每個[計數]鍵,下降到主陣列按鍵排序?以便它們按以下順序排列:1 -2 -0
您可以使用'uasort'來維護密鑰關聯 –
謝謝!這就是我在尋找 –
@傑克默多克,假設@soren會想索引訪問數組,'uasort'會和他想要的完全相反。如果'$ array [0]'在'$ array [1]'之後進行排序,那麼結果數組就是'$ array(1,0)',這很少有用,除非像我在我的回答中提到的那樣,數組是關聯。 – rockerest