我有这个数组:
$arr1 = array (
array (
array (
'correct' => FALSE,
'answer' => 'false answer1'
),
array (
'correct' => FALSE,
'answer' => 'false answer2'
),
array (
'correct' => FALSE,
'answer' => 'false answer3'
)
));
而这个数组:
$arr2 = array (
array (
array (
'correct' => TRUE,
'answer' => 'correct answer'
)
));
我希望输出为:
$output = array (
array (
array (
'correct' => FALSE,
'answer' => 'false answer1'
),
array (
'correct' => FALSE,
'answer' => 'false answer2'
),
array (
'correct' => FALSE,
'answer' => 'false answer3'
),
array (
'correct' => TRUE,
'answer' => 'correct answer'
)
));
我试过using array_merge
, array_merge_recursive
,但它并没有按照我想要的方式合并它(它只是在底部添加了值,而不是正确地将它们放入每个数组中)。我也看到了与此类似的问题,但它对我没有帮助(仍然合并底部的值,而不是我想要的方式)。
有什么建议么?