我有PHP數組,看起來像按訂單
$my_arr['cats'] = array('Shadow', 'Tiger', 'Luna');
$my_arr['dogs'] = array('Buddy', 'Lucy', 'Bella');
$my_arr['dolphins'] = array('Sunny', 'Comet', 'Pumpkin');
$my_arr['lizzards'] = array('Apollo', 'Eddie', 'Bruce');
//and many more lines like this
我需要根據它的鍵使用排序數組一樣
$order = array('lizzards', 'cats');
排序它,我想第一項目應該是lizzards數組,第二項 - 貓然後所有未在$ order數組中指定的項目。如何使用usort/uasort/uksort函數來完成?
您正在尋找多數組排序? http://php.net/manual/en/function.array-multisort.php – cosmoonot
不,我不需要排序內部陣列 – moonvader