我的数组结构如下 -
Array
(
[0] => Array
(
[points] => 10
[details] => Array
(
[name] => Team A
[rank] =>
)
)
[1] => Array
(
[points] => 10
[details] => Array
(
[name] => Team B
[rank] =>
)
)
[2] => Array
(
[points] => 8
[details] => Array
(
[name] => Team C
[rank] =>
)
)
[3] => Array
(
[points] => 6
[details] => Array
(
[name] => Team D
[rank] =>
)
)
)
现在我希望结果数组是 -
Array
(
[0] => Array
(
[points] => 10
[details] => Array
(
[name] => Team A
[rank] => 1
)
)
[1] => Array
(
[points] => 10
[details] => Array
(
[name] => Team B
[rank] => 1
)
)
[2] => Array
(
[points] => 8
[details] => Array
(
[name] => Team C
[rank] => 2
)
)
[3] => Array
(
[points] => 6
[details] => Array
(
[name] => Team D
[rank] => 3
)
)
)
我怎样才能实现这个输出?我尝试遍历数组中的每个元素并比较点,但我没有发现真正的效果。任何帮助,将不胜感激。