// Source
Array
(
[name] => ben
[country] => ca
[msg] => Array
(
[type] => mail
[read] => 0
[content] => hello world
)
)
// Change
Array
(
[msg] => Array
(
[read] => 1
)
)
// Result
Array
(
[name] => ben
[country] => ca
[msg] => Array
(
[type] => mail
[read] => 1
[content] => hello world
)
)
$result = php_function($source,$change);
What php function allows this kind of transformation?
the function you are looking for is
array_merge_recursive_simple()See the comment to the php.net documentation of
array_merge_resursiveEdit: This one is more elegant.