I have two multidimensional arrays and I want the difference. For eg. I have taken two-dimensional two arrays below
$array1 = Array (
[a1] => Array (
[a_name] => aaaaa
[a_value] => aaa
)
[b1] => Array (
[b_name] => bbbbb
[b_value] => bbb
)
[c1] => Array (
[c_name] => ccccc
[c_value] => ccc
)
)
$array2 = Array (
[b1] => Array (
[b_name]=> zzzzz
)
)
Now I want the key difference of these two arrays. I have tried array_diff_key() but it doesnot work for multidimensional.
array_diff_key($array1, $array2)
I want the output as following
//output
$array1 = Array (
[a1] => Array (
[a_name] => aaaaa
[a_value] => aaa
)
[b1] => Array (
[b_value] => bbb
)
[c1] => Array (
[c_name] => ccccc
[c_value] => ccc
)
)
If you think my question is genuine please accept it and answer. Thank you.
EDIT
Now if the second array is
$array2 = Array( [b1] => zzzzz)
The result should be
$array1 = Array (
[a1] => Array (
[a_name] => aaaaa
[a_value] => aaa
)
[c1] => Array (
[c_name] => ccccc
[c_value] => ccc
)
)
b1. What do you really want?here is my task: ... - Can you make it for me please. This is not a place where people would make something for you. We just can suppose some ideas.Returns an array containing all the entries from array1 that are not present in any of the other arrays.