我有一个数组:
Array
(
[0] => Array
(
[filePath] => 0000000023.jpg
)
[1] => Array
(
[0] => Array
(
[Label] => Array
(
[0] => Person
[1] => Person
)
[Score] => Array
(
[0] => 0.999217033
[1] => 0.999318361
)
[Coordinates] => Array
(
[0] => Array
(
[0] => 338
[1] => 430
[2] => 307
[3] => 506
)
[1] => Array
(
[0] => 71
[1] => 104
[2] => 318
[3] => 483
)
)
)
)
)
我需要让它看起来像这样:
Array
(
[0] => Array
(
[filePath] => 0000000023.jpg
)
[1] => Array
(
[0] => Array
(
[Label] => Person
[Score] => 0.999217033
[Coordinates] =>
[0] => Array
(
[0] => 338
[1] => 430
[2] => 307
[3] => 506
)
)
[1] => Array
(
[Label] => Person
[Score] => 0.999318361
[Coordinates] =>
[0] => Array
(
[0] => 71
[1] => 104
[2] => 318
[3] => 483
)
)
)
)
在Ruby中我可以使用map和select来获得结果但是在PHP中我无法弄明白。我设法用Foreach
循环来做到这一点,但它非常丑陋且很多if语句。
我很感激任何指导。
答案 0 :(得分:-1)
为什么要提取数组?你不能像这样直接创建你的数组吗?
多维php数组非常难看。你不能使用对象的集合吗?