<?php
$arr1 = [
'teste' => [
'teste' => [
"id_loja" => 123,
"id_subloja" => 111,
"nm_loja" => "teste"
]
]
];
$arr2 = [
'teste' => [
'teste' => [
"id_loja" => 123,
"id_subloja" => 111,
"id_forn" => 9
]
]
];
echo "--------------------------------------------\n";
var_dump($arr1 + $arr2);
echo "--------------------------------------------\n";
var_dump(array_merge($arr1 , $arr2));
echo "--------------------------------------------\n";
var_dump(array_merge_recursive($arr1 , $arr2));
- Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- --------------------------------------------
array(1) {
["teste"]=>
array(1) {
["teste"]=>
array(3) {
["id_loja"]=>
int(123)
["id_subloja"]=>
int(111)
["nm_loja"]=>
string(5) "teste"
}
}
}
--------------------------------------------
array(1) {
["teste"]=>
array(1) {
["teste"]=>
array(3) {
["id_loja"]=>
int(123)
["id_subloja"]=>
int(111)
["id_forn"]=>
int(9)
}
}
}
--------------------------------------------
array(1) {
["teste"]=>
array(1) {
["teste"]=>
array(4) {
["id_loja"]=>
array(2) {
[0]=>
int(123)
[1]=>
int(123)
}
["id_subloja"]=>
array(2) {
[0]=>
int(111)
[1]=>
int(111)
}
["nm_loja"]=>
string(5) "teste"
["id_forn"]=>
int(9)
}
}
}
preferences:
170.87 ms | 405 KiB | 159 Q