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

    {

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

    }
<?php     {

        $caster = $this->resolveCasterClass($key);



        $this->attributes = array_replace(

            $this->attributes,

            $this->normalizeCastClassResponse($key, $caster->set(

                $this, $key, $value, $this->attributes

            ))

        );



        if ($caster instanceof CastsInboundAttributes ||

            ! is_object($value) ||
<?php         $symfonyRequest = SymfonyRequest::create(

            $this->prepareUrlForRequest($uri), $method, $parameters,

            $cookies, $files, array_replace($this->serverVariables, $server), $content

        );



        $response = $kernel->handle(
<?php         $fields = array_fill_keys($matches[0], null);



        $route->setBindingFields(array_replace(

            $fields, array_intersect_key($bindingFields, $fields)

        ));

    }
<?php             return false;

        }



        [$numerator, $denominator] = array_replace(

            [1, 1], array_filter(sscanf($parameters['ratio'], '%f/%d'))

        );



        $precision = 1 / (max($width, $height) + 1);
<?php     {



        $serverOverrides = array_replace([

            'HTTP_X_FORWARDED_FOR' => '173.174.200.38',         // X-Forwarded-For    -- getClientIp()

            'HTTP_X_FORWARDED_HOST' => 'serversforhackers.com', // X-Forwarded-Host   -- getHosts()

            'HTTP_X_FORWARDED_PORT' => '443',                   // X-Forwarded-Port   -- getPort()

            'HTTP_X_FORWARDED_PREFIX' => '/prefix',             // X-Forwarded-Prefix -- getBaseUrl()

            'HTTP_X_FORWARDED_PROTO' => 'https',                // X-Forwarded-Proto  -- getScheme() / isSecure()

            'SERVER_PORT' => 8888,

            'HTTP_HOST' => 'localhost',

            'REMOTE_ADDR' => '192.168.10.10',

        ], $serverOverrides);