array_merge_recursive

Supported Versions: PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8
Merge one or more arrays recursively
<?php array_merge_recursive(array ...$arrays): array
<?php         if (method_exists($this, 'rules')) $rulesFromComponent = $this->rules();

        else if (property_exists($this, 'rules')) $rulesFromComponent = $this->rules;



        $rulesFromOutside = array_merge_recursive(

            ...array_map(

                fn($i) => value($i),

                $this->rulesFromOutside

            )

        );



        return array_merge($rulesFromComponent, $rulesFromOutside);

    }
<?php     public function mergeRecursive($items)

    {

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

    }
<?php     public function mergeBindings(self $query)

    {

        $this->bindings = array_merge_recursive($this->bindings, $query->bindings);



        return $this;

    }
<?php         $events = [];



        foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) {

            $providerEvents = array_merge_recursive($provider->shouldDiscoverEvents() ? $provider->discoverEvents() : [], $provider->listens());



            $events[get_class($provider)] = $providerEvents;

        }
<?php             return $cache[get_class($this)] ?? [];

        } else {

            return array_merge_recursive(

                $this->discoveredEvents(),

                $this->listens()

            );

        }

    }
<?php                         return ! is_dir($directory);

                    })

                    ->reduce(function ($discovered, $directory) {

                        return array_merge_recursive(

                            $discovered,

                            DiscoverEvents::within($directory, $this->eventDiscoveryBasePath())

                        );

                    }, []);

    }
<?php     public function withQueryParameters(array $parameters)

    {

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

            $this->options = array_merge_recursive($this->options, [

                'query' => $parameters,

            ]);

        });

    }
<?php     public function withHeaders(array $headers)

    {

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

            $this->options = array_merge_recursive($this->options, [

                'headers' => $headers,

            ]);

        });

    }
<?php     public function withCookies(array $cookies, string $domain)

    {

        return tap($this, function () use ($cookies, $domain) {

            $this->options = array_merge_recursive($this->options, [

                'cookies' => CookieJar::fromArray($cookies, $domain),

            ]);

        });

    }
<?php     {

        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         return tap(response()->json(

            $this->wrap(

                $this->resource->resolve($request),

                array_merge_recursive(

                    $this->paginationInformation($request),

                    $this->resource->with($request),

                    $this->resource->additional

                )

            ),

            $this->calculateStatus(),

            [],
<?php             $data = [($this->wrapper() ?? 'data') => $data];

        }



        return array_merge_recursive($data, $with, $additional);

    }
<?php             'where' => static::formatWhere($new, $old),

        ]);



        return array_merge_recursive(Arr::except(

            $old, ['namespace', 'prefix', 'where', 'as']

        ), $new);

    }
<?php             $messages = $messages->getMessageBag()->getMessages();

        }



        $this->messages = array_merge_recursive($this->messages, $messages);



        return $this;

    }