PHPでn個の配列をマージする方法. つまり、次のような仕事をどのように行うことができますか:
array_merge(from : $result[0], to : $result[count($result)-1])
OR
array_merge_recursive(from: $result[0], to : $result[count($result) -1])
$result
このように内部に複数の配列を持つ配列はどこにありますか:
$result = Array(
0 => array(),//associative array
1 => array(),//associative array
2 => array(),//associative array
3 => array()//associative array
)
私の結果は:
$result = Array(
0 => Array(
"name" => "Name",
"events" => 1,
"types" => 2
),
1 => Array(
"name" => "Name",
"events" => 1,
"types" => 3
),
2 => Array(
"name" => "Name",
"events" => 1,
"types" => 4
),
3 => Array(
"name" => "Name",
"events" => 2,
"types" => 2
),
4 => Array(
"name" => "Name",
"events" => 3,
"types" => 2
)
)
そして、私が必要なのは
$result = Array(
"name" => "name",
"events" => array(1,2,3),
"types" => array(2,3,4)
)