I have an array:
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
)
)
)
)
)
I need to make it to be look like this:
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
)
)
)
)
In Ruby I can use map and select to get the result however in PHP I can't figure it out. I managed to do it with Foreach
loop however it is very ugly and lots of if statement.
I'd appreciate any guidance.