-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerge.php
More file actions
43 lines (39 loc) · 712 Bytes
/
merge.php
File metadata and controls
43 lines (39 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
$arrA = ['one' => 'a', 'two' => 'b', 3 => 'three', 4 => 8];
$arrB = ['one' => 'c', 'hello' => 'world', 4 => 10, 3 => 'ten', '3'=>'ggg'];
$arrC = $arrA + $arrB;
var_dump($arrC);
echo "============================\n";
$arrD = array_merge($arrA, $arrB);
var_dump($arrD);
//array(5) {
// ["one"]=>
// string(1) "a"
// ["two"]=>
// string(1) "b"
// [3]=>
// string(5) "three"
// [4]=>
// int(8)
// ["hello"]=>
// string(5) "world"
//}
//============================
//array(7) {
// ["one"]=>
// string(1) "c"
// ["two"]=>
// string(1) "b"
// [0]=>
// string(5) "three"
// [1]=>
// int(8)
// ["hello"]=>
// string(5) "world"
// [2]=>
// int(10)
// [3]=>
// string(3) "ten"
//}
//
?>