public static function arrayDiffReplaceRecursive(array $a1, array $a2, $valueIfDelete = null):array
    {
        $diff = [];
        foreach ($a1 as $key => $value) {
            if (!array_key_exists($key, $a2)) {
                $diff[$key] = $valueIfDelete;
            } else { 
                if (!is_array($value) && $value !== $a2[$key]) {
                    $diff[$key] = $a2[$key];
                } else if (is_array($value) && !is_array($a2[$key])) {
                    $diff[$key] = $a2[$key];
                } else if (is_array($value) && is_array($a2[$key])) {
                    $subDiff = self::arrayDiffReplaceRecursive($value, $a2[$key], $valueIfDelete);
                    if ($subDiff !== []) {
                        $diff[$key] = $subDiff;
                    }
                }
                unset($a2[$key]);
            }
        }
        if (count($a2)) {
            $diff = array_merge($diff, $a2);
        }
        return $diff;
    }