note 89573 deleted from function.array-diff-assoc by danbrown

From: Date: Sat, 14 Mar 2009 14:51:26 +0000
Subject: note 89573 deleted from function.array-diff-assoc by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151898@lists.php.net to get a copy of this message
Note Submitter: alan at ford dot com ---- function array_diff_assoc_recursive($array1, $array2) { $result = array(); foreach ($array1 as $key => $value) { if (is_array($value) && is_array($array2[$key])) { $diff = array_diff_assoc_recursive($value, $array2[$key]); if (!empty($diff)) { $result[$key] = $diff; } } elseif (!isset($array2[$key]) || $value != $array2[$key]) { $result[$key] = $value; } } return $result; }

« previous php.notes (#151898) next »