diff --git a/src/Utility/Utils.php b/src/Utility/Utils.php new file mode 100644 index 0000000..9f63c24 --- /dev/null +++ b/src/Utility/Utils.php @@ -0,0 +1,32 @@ + $value) { + //if the key exists in the second array, recursively call this function + //if it is an array, otherwise check if the value is in arr2 + if (array_key_exists($key, $arr2)) { + if (is_array($value)) { + $recursiveDiff = array_diff_recursive($value, $arr2[$key]); + + if (count($recursiveDiff)) { + $outputDiff[$key] = $recursiveDiff; + } + } else if (!in_array($value, $arr2)) { + $outputDiff[$key] = $value; + } + } + //if the key is not in the second array, check if the value is in + //the second array (this is a quirk of how array_diff works) + else if (!in_array($value, $arr2)) { + $outputDiff[$key] = $value; + } + } + + return $outputDiff; +}