Yet another recursive implementation, without if-else hell and with multiple parameters just like the original.
<?php
function recursiveDiff() {
$arrs = func_get_args();
$diff = call_user_func_array('array_diff_assoc', $arrs);
foreach($diff as $key => $value) {
if (!is_array($value))
continue;
$children = array_map(function($arr) use($key){
return $arr[$key];
}, $arrs);
$diff[$key] = call_user_func_array(__FUNCTION__, $children);
}
return $diff;
}