次の配列があります。(var_dump出力)これらの同じキー要素を単一の配列に結合したいと思います。それ、どうやったら出来るの?
array (size=3)
'totals' =>
array (size=3)
0 =>
array (size=1)
'total' => string '4' (length=1)
1 =>
array (size=1)
'total' => string '50' (length=2)
2 =>
array (size=1)
'total' => string '44' (length=2)
'styles' =>
array (size=3)
0 =>
array (size=1)
'style' => string '11' (length=2)
1 =>
array (size=1)
'style' => string 'aaa' (length=3)
2 =>
array (size=1)
'style' => string 'bb' (length=3)
'colors' =>
array (size=3)
0 =>
array (size=1)
'color' => string '11' (length=2)
1 =>
array (size=1)
'color' => string 'ccc' (length=3)
2 =>
array (size=1)
'color' => string 'ddd' (length=3)
最終的な出力は次のようになります。
'totals' =>
array (size=3)
0 =>
array (size=1)
'total' => string '4' (length=1)
'style' => string '11' (length=2)
'color' => string '11' (length=2)
'styles' =>
array (size=3)
1 =>
array (size=1)
'total' => string '50' (length=2)
'style' => string 'aaa' (length=3)
'color' => string 'bb' (length=3)
'colors' =>
array (size=3)
2 =>
array (size=1)
'total' => string '44' (length=2)
'style' => string 'ccc' (length=3)
'color' => string 'ddd' (length=3)