I have made this solution, this is working fine for the normal arrays but failed for multidimensional arrays.
$a = ['a'=>11, 'b'=>2,'c'=>['r'=>5,'s'=>8]];
$b = ['a'=>1, 'b'=>2, 'c'=>['r'=>15,'s'=>18]];
function array_equal($a, $b) {
return (
is_array($a)
&& is_array($b)
&& count($a) == count($b)
&& array_diff_key($a, $b) === array_diff_key($b, $a)
);
}
$c = array_equal($a,$b);
echo $c;
For the Above set of arrays it is working fine.
But for the below arrays it returns 1 even if keys are different.
$a = ['a'=>11, 'b'=>2,'c'=>['r'=>5,'s'=>8]];
$b = ['a'=>1, 'b'=>2, 'c'=>['r1'=>15,'m'=>18]];