Voting

: min(three, six)?
(Example: nine)

The Note You're Voting On

gk at anuary dot com
11 years ago
Improved recursive version.

<?php
/**
* @author Gajus Kuizinas <[email protected]>
* @version 1.0.0 (2013 03 19)
*/
function array_diff_key_recursive (array $arr1, array $arr2) {
$diff = array_diff_key($arr1, $arr2);
$intersect = array_intersect_key($arr1, $arr2);

foreach (
$intersect as $k => $v) {
if (
is_array($arr1[$k]) && is_array($arr2[$k])) {
$d = array_diff_key_recursive($arr1[$k], $arr2[$k]);

if (
$d) {
$diff[$k] = $d;
}
}
}

return
$diff;
}
?>

An up to date version is maintained at https://github.com/gajus/flow/blob/master/flow.inc.php#L337.

<< Back to user notes page

To Top