To make my question easier to understand, I will give an example output.
为了使我的问题更容易理解,我将给出一个示例输出。
var_dump output:
var_dump输出:
Array 1:
数组1:
array(22) { ["#HIDDEN_ID"]=> string(10) "08/11/2013"
array(22){[“#HIDDEN_ID”] => string(10)“08/11/2013”
Array 2:
数组2:
array(22) { ["#HIDDEN_ID"]=> string(96) "www.google.co.uk....."
array(22){[“#HIDDEN_ID”] => string(96)“www.google.co.uk .....”
Array one is sorted by most recent date, however my second array is not but it has the same file ids.
数组1按最近的日期排序,但是我的第二个数组不是,但它具有相同的文件ID。
Therefore I would like to sort my second array to how my first arrays file ids are stored.
因此,我想将我的第二个数组排序为如何存储我的第一个数组文件ID。
I have no clue how to do this using uasort or usort.
我不知道如何使用uasort或usort做到这一点。
Any help would be greatly appreciated!
任何帮助将不胜感激!
1 个解决方案
#1
1
$keys = array_keys($array1);
array_multisort($keys, SORT_ASC, $array2);
#1
1
$keys = array_keys($array1);
array_multisort($keys, SORT_ASC, $array2);