How find difference of the two array
// ARRAY 1
$a1 = array(
"a1" => 1,
"a3" => array(
"a31" => 31
),
"a4" => array(
"a41" => 41
),
"a5" => array(
"a51" => 51,
"a52" => 52
)
);
// ARRAY 2
$a2 = array(
"a1" => 1,
"a2" => 2,
"a3" => array(
"a31" => 31,
"a32" => array(
"a321" => 321,
"a322" => 322
)
),
"a4" => array(
"a41" => 42
),
"a5" => array(
"a51" => 51,
"a52" => 52
)
);
array_diff function returns ==> Array ( )
But there is a lot of difference exist in the above two array variables.
example:
- in ARRAY1 There is no key a2 but in ARRAY2 a2 is available.
- ARRAY2 a3 contain nested array (one nested level ) but in ARRAY 2 contain two nested sub level.
So here i want to compare two array n-level (ie. nested array)