The recursive function suggested by '2ge at 2ge dot us' will provide you with empty arrays if there's no diff.
This variant of the function cleans up empty arrays and fixes a bug in the first suggested version. It works 100%
.
<?php
function array_diff_key_recursive ($a1, $a2) {
foreach($a1 as $k => $v) {
//$r[$k] = is_array($v) ? $this->array_diff_key_recursive($a1[$k], $a2[$k]) : array_diff_key($a1, $a2);
if (is_array($v))
{
$r[$k]=$this->array_diff_key_recursive($a1[$k], $a2[$k]);
}else
{
$r=array_diff_key($a1, $a2);
}
if (is_array($r[$k]) && count($r[$k])==0)
{
unset($r[$k]);
}
}
return $r;
}
?>