|
复制代码 代码如下:
$b = array('d'=>'adddd','adsdfd','asdfsddddd','d'=>'aass');
$d = $a + $b;
$e = array_merge($a,$b);
var_dump($d);
var_dump($e);
打印:
array
'd' => string 'aass' (length=4)
'e' => string 'adsdfd' (length=6)
'asd' => string 'asdsdd' (length=6)
'ddfg' => string 'dssdf' (length=5)
0 => string 'adsdfd' (length=6)
1 => string 'asdfsddddd' (length=10)
array
'd' => string 'aass' (length=4)
'e' => string 'adsdfd' (length=6)
'asd' => string 'asdsdd' (length=6)
'ddfg' => string 'dssdf' (length=5)
0 => string 'adsdfd' (length=6)
1 => string 'asdfsddddd' (length=10)
php技术:解析php中array_merge与array+array的区别,转载需保留来源!
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。