我想在php中的md数组中将两个树合并为多维到一棵树:
$ array [1] = Array
[0] => a
[1] => b
[2] => c
$ array [2] = Array
[0] => d
[1] => e
[2] => f
结果:
$ array [1] = Array
[0] => ad
[1] => be
[2] => cf
答案 0 :(得分:0)
你可以试试这个:
<?php
foreach($array[1] as $key => $value)
{
$array[1][$key] = $value.$array[2][$key];
}
?>
答案 1 :(得分:0)
We can use array function to solve this Problem Like this :
$array = array('a','b','c');
$array2 = array('d','e','f');
$c = array_combine($array, $array2);
foreach($c as $key=>$value){
$data[] = $key.$value;
}
print_r($data);