$list = array(0=>'a0,b0',1=>'a1,b1',2=>'a2,b2);
$man = array(0=>'c0',1=>'c1',2=>'c2');
现在我需要 合并成新的数组$xin = array(0=>'a0,b0,c0',1=>'a1,b1,c1',2=>'a2,b2,c2');
要怎么实现
$list = array(0=>'a0,b0',1=>'a1,b1',2=>'a2,b2);
$man = array(0=>'c0',1=>'c1',2=>'c2');
现在我需要 合并成新的数组$xin = array(0=>'a0,b0,c0',1=>'a1,b1,c1',2=>'a2,b2,c2');
要怎么实现
function array_merge_for_string(array $first, array $sencond){
foreach($second as $index => $value){
$first[$index] = isset($first[$index]) ? "{$first[$index]},{$second[$index]}" : {$second[$index];
}
return $first;
}
array_merge_for_string($list,$man)
望采纳