array_replace_recursive

Supported Versions: PHP 5 >= 5.3.0, PHP 7, PHP 8
Replaces elements from passed arrays into the first array recursively
<?php array_replace_recursive(array $array, array ...$replacements): array
<?php     public function replaceRecursive($items)

    {

        return new static(array_replace_recursive($this->items, $this->getArrayableItems($items)));

    }
<?php     public static function resolveRelationUsing($name, Closure $callback)

    {

        static::$relationResolvers = array_replace_recursive(

            static::$relationResolvers,

            [static::class => [$name => $callback]]

        );

    }
<?php     public function withOptions(array $options)

    {

        return tap($this, function () use ($options) {

            $this->options = array_replace_recursive(

                array_merge_recursive($this->options, Arr::only($options, $this->mergeableOptions)),

                $options

            );

        });

    }
<?php     public function mergeOptions(...$options)

    {

        return array_replace_recursive(

            array_merge_recursive($this->options, Arr::only($options, $this->mergeableOptions)),

            ...$options

        );

    }
<?php     public function all($keys = null)

    {

        $input = array_replace_recursive($this->input(), $this->allFiles());



        if (! $keys) {

            return $input;
<?php         $other = $this->toArray($other);

        $this->subset = $this->toArray($this->subset);



        $patched = array_replace_recursive($other, $this->subset);



        if ($this->strict) {

            $result = $other === $patched;
<?php                 $file = "{$path}/vendor/{$namespace}/{$locale}/{$group}.php";



                if ($this->files->exists($file)) {

                    $lines = array_replace_recursive($lines, $this->files->getRequire($file));

                }



                return $lines;
<?php         return collect($paths)

            ->reduce(function ($output, $path) use ($locale, $group) {

                if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) {

                    $output = array_replace_recursive($output, $this->files->getRequire($full));

                }



                return $output;