array_multisort 关联(string)键名保持不变,但数字键名会被重新索引。
$array = [ '2' => [ 'title' => 'Flower', 'order' => 3 ], '3' => [ 'title' => 'Rock', 'order' => 1 ], '4' => [ 'title' => 'Grass', 'order' => 2 ] ]; $keys = array_keys($array); array_multisort( array_column($array, 'order'), SORT_DESC, SORT_NUMERIC, $array, $keys ); $array = array_combine($keys, $array); print_r($array);