I want to add data of two Key=>Value pair array for matching keys.
I have these two arrays
$array1=array(
'a'=>1,
'b'=>2,
'c'=>3,
'd'=>4
);
$array2=array(
'c'=>3,
'd'=>4
);
I am using array_merge_recursive
to merge these arrays like this
$array_merge=array_merge_recursive($array1,$array2);
print_r($array_merge);
But it doesn't add two arrays it gives result like
Array (
[a] => 1
[b] => 2
[c] => 3
[d] => 4
)
Is it possible to get result like
Array (
[a] => 1
[b] => 2
[c] => 6
[d] => 8
)
Please see and suggest any possible way to do this.
Thanks