次の 2 つの配列があります。
$Array1 = array(array('x1','x2','x3'),array('x4','x5','x6'));
$Array2 = array(array('z1','z2','z3'),array('z4','z5','z6'));
印刷すると、次のように返されます。
Array
(
[0] => Array
(
[x1] => x1
[x2] => x2
[x3] => x3
)
[1] => Array
(
[x4] => x4
[x5] => x5
[x6] => x6
)
)
Array
(
[0] => Array
(
[z1] => z1
[z2] => z2
[z3] => z3
)
[1] => Array
(
[z4] => z4
[z5] => z5
[z6] => z6
)
)
それらを組み合わせて、同じキーを使用して組み合わせた以下の例のような単一の配列を生成するにはどうすればよいですか:
Array
(
[0] => Array
(
[x1] => x1
[x2] => x2
[x3] => x3
[z1] => z1
[z2] => z2
[z3] => z3
)
[1] => Array
(
[x4] => x4
[x5] => x5
[x6] => x6
[z1] => z4
[z2] => z5
[z3] => z6
)
)
私は使用してみました:
array_merge=($Array1,$Array2)
array_merge_recursive($Array1,$Array2)
array_combine($Array1,$Array2) [which genereated an error, so I guess I was using it wrong]
$Array1 + $Array2
しかし、これらのどれも機能していません。