我有如下数组:
阵 ( [5263] =>排列 ( [SOC026020] => 1 [SOC045000] => 1 [FIC022010] => 2 [FIC030000] => 2
)
[5098] => Array
(
[JUV026000] => 2
[JUV015020] => 2
[JUV039030] => 2
[PER004010] => 1
[PER004030] => 1
[PER004020] => 1
[FIC019000] => 3
[FIC061000] => 1
[JUV028000] => 1
)
[5341] => Array
(
[FIC031000] => 2
[JUV028000] => 4
)
)
我需要排序如下:
阵 ( [5263] =>排列 ( [FIC022010] => 2 [FIC030000] => 2 [SOC026020] => 1 [SOC045000] => 1
)
[5098] => Array
(
[FIC019000] => 3
[JUV026000] => 2
[JUV015020] => 2
[JUV039030] => 2
[PER004010] => 1
[PER004030] => 1
[PER004020] => 1
[FIC061000] => 1
[JUV028000] => 1
)
[5341] => Array
(
[JUV028000] => 4
[FIC031000] => 2
)
)
I have array like below:
Array
(
[5263] => Array
(
[SOC026020] => 1
[SOC045000] => 1
[FIC022010] => 2
[FIC030000] => 2
)
[5098] => Array
(
[JUV026000] => 2
[JUV015020] => 2
[JUV039030] => 2
[PER004010] => 1
[PER004030] => 1
[PER004020] => 1
[FIC019000] => 3
[FIC061000] => 1
[JUV028000] => 1
)
[5341] => Array
(
[FIC031000] => 2
[JUV028000] => 4
)
)
I need to sort like below:
Array
(
[5263] => Array
(
[FIC022010] => 2
[FIC030000] => 2
[SOC026020] => 1
[SOC045000] => 1
)
[5098] => Array
(
[FIC019000] => 3
[JUV026000] => 2
[JUV015020] => 2
[JUV039030] => 2
[PER004010] => 1
[PER004030] => 1
[PER004020] => 1
[FIC061000] => 1
[JUV028000] => 1
)
[5341] => Array
(
[JUV028000] => 4
[FIC031000] => 2
)
)

答案 0 :(得分:0)
您可以按如下方式对内部数组进行排序。
foreach($test as $key => $value){
arsort($value);
$test[$key] = $value;
}
希望这会对你有所帮助。