Think before you speak, read before you think.

php array merge

by

in

两个数组合并为一个数组

$a = array(1 => 1, 2 => 2, 3 => 3);
$b = array(3 => 3, 5 => 5, 6 => 6);
$c = $a + $b;
print_r($c);

结果

Array
(
    [1] => 1
    [2] => 2
    [3] => 3
    [5] => 5
    [6] => 6
)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *