初始数组:
Array
(
[0] => Array (
[0] => "Kate"
[1] => Array ( [0] => 1 [1] => 30 [2] => 11 )
[2] => "Seattle"
)
[1] => Array (
[0] => "Kate"
[1] => Array ( [0] => 100 [1] => 7 [2] => 55 )
[2] => "Seattle"
)
[2] => Array (
[0] => "Mike"
[1] => Array ( [0] => 1 [1] => 2 [2] => 13 )
[2] => "New York"
)
[3] => Array (
[0] => "Paul"
[1] => Array ( [0] => 5 [1] => 34 [2] => 9 )
[2] => "Chicago"
)
[4] => Array (
[0] => "Mike"
[1] => Array ( [0] => 1 [1] => 30 [2] => 13 )
[2] => "New York"
)
)
期望的输出:
Array
(
[0] => Array (
[0] => "Kate"
[1] => Array ( [0] => 1 [1] => 30 [2] => 11 [3] => 100 [4] => 7 [5] => 55 )
[2] => "Seattle"
)
[1] => Array (
[0] => "Mike"
[1] => Array ( [0] => 1 [1] => 2 [2] => 13 [3] => 30 )
[2] => "New York"
)
[2] => Array (
[0] => "Paul"
[1] => Array ( [0] => 5 [1] => 34 [2] => 9 )
[2] => "Chicago"
)
)
我想根据 [0] 中的字符串值简化数组,例如“Kate”、“Mike”或“Paul”。在这样做的同时,我想合并 [1] 中的数组并使其独一无二,就像“Mike”在 Desired Output 中的数组一样。
我不知道该做什么或从哪里开始。请帮忙!