我一共有三个数组
阵列 1
array1 = Array(
[0] => Array(
[name] => John
[city] => San Francisco
[state] => CA
)
[1] => Array(
[name] => Smith
[city] => Atlanta
[state] => GA
)
[2] => Array(
[name] => Peter
[city] => New York
[state] => NY
)
[3] => Array(
[name] => Mary
[city] => San Jose
[state] => CA
)
)
数组 2(按平均年龄排序)
array2 = Array(
[0] => CA
[1] => NY
[2] => GA
)
数组 3(按人口排序)
array3 = Array(
[0] => New York
[1] => San Francisco
[2] => Atlanta
[3] => San Jose
)
如何首先根据数组 2 对数组 1 进行排序,然后再根据数组 3 对数组 1 进行排序。我想要以下输出:
排序数组 1
Array
(
[0] => Array
(
[name] => John
[city] => San Francisco
[state] => CA
)
[1] => Array
(
[name] => Mary
[city] => San Jose
[state] => CA
)
[2] => Array
(
[name] => Peter
[city] => New York
[state] => NY
)
[3] => Array
(
[name] => Smith
[city] => Atlanta
[state] => GA
)
)
我尝试使用array_multisort
来实现这一点,但它不起作用,例如
array_multisort($array2,$array3,$array1)
非常感谢任何帮助。