public static function array_replace_recursive($array1, $array2)
    {
        if (function_exists('array_replace_recursive')) {
            return array_replace_recursive($array1, $array2);
        }

        foreach ($array2 as $key => $value) {
            if (is_array($value)) {
                $array1[$key] = self::array_replace_recursive($array1[$key], $value);
            } else {
                $array1[$key] = $value;
            }
        }
        return $array1;
    }
public static function array_replace_recursive($array1, $array2)
    {
        if (function_exists('array_replace_recursive')) {
            return array_replace_recursive($array1, $array2);
        }

        foreach ($array2 as $key => $value) {
            if (is_array($value)) {
                $array1[$key] = self::array_replace_recursive($array1[$key], $value);
            } else {
                $array1[$key] = $value;
            }
        }
        return $array1;
    }
public static function array_replace_recursive ( $ array1 , $ array2 ) { if ( function_exists ( 'array_replace_recursive' ) ) { return array_replace_recursive ( $ array1 , $ array2 ) ; } foreach ( $ array2 as $ key => $ value ) { if ( is_array ( $ value ) ) { $ array1 [ $ key ] = self :: array_replace_recursive ( $ array1 [ $ key ] , $ value ) ; } else { $ array1 [ $ key ] = $ value ; } } return $ array1 ; }
Custom array_replace_recursive to be used if PHP < 5.3
Replaces elements from passed arrays into the first array recursively.

@param array $array1 The array in which elements are replaced
@param array $array2 The array from which elements will be extracted

@return array Returns an array, or NULL if an error occurs.
Custom array_replace_recursive to be used if PHP < 5 . 3 Replaces elements from passed arrays into the first array recursively .