欢迎各位兄弟 发布技术文章
这里的技术是共享的
结果:
array(2) {
[0]=> string(1) "a"
[1]=> string(1) "b"
}
array(4) {
[0]=> string(1) "a"
[1]=> string(1) "b"
[2]=> string(1) "c"
[3]=> string(1) "d"
}
-----------------------------------------------------
$a = array(0 => 'a', 1 => 'b'); $b = array(0 => 'c', 1 => 'b');结果:
array(2) {
[0]=> string(1) "a"
[1]=> string(1) "b"
}
array(4) {
[0]=> string(1) "a"
[1]=> string(1) "b"
[2]=> string(1) "c"
[3]=> string(1) "b"
}
-----------------------------------------------------
$a = array('a', 'b'); $b = array('0' => 'c', 1 => 'b');结果:
array(2) {
[0]=> string(1) "a"
[1]=> string(1) "b"
}
array(4) {
[0]=> string(1) "a"
[1]=> string(1) "b"
[2]=> string(1) "c"
[3]=> string(1) "b"
}
-----------------------------------------------------
结果:
array(2) {
[0]=> string(1) "a"
[1]=> string(1) "b"
}
array(4) {
[0]=> string(1) "a"
[1]=> string(1) "b"
[2]=> string(1) "c"
[3]=> string(1) "b"
}
-----------------------------------------------------
$array1 = array('asd'=>'0'); $array2 = array('asd' => "data");
$result1 = $array1 + $array2 ;/*结果为$array1的值*/
var_dump($result1);
$result2 = array_merge($array1,$array2);/*结果为$array2*/
var_dump($result2);
结果:
array(1) {
["asd"]=> string(1) "0"
}
array(1) {
["asd"]=> string(4) "data"
}