array_replace

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);
<?php             $parameters,

            $cookies,

            $files,

            array_replace($this->serverVariables, $server),

            $content

        );
<?php     public function configure(array $config = [])

    {

        $this->config = array_replace($this->config, $config);



        return $this;

    }
<?php     public function preProcess($data)

    {

        return array_replace($this->blankKeyed(), $data ?? []);

    }



    public function preProcessConfig($data)
<?php         $platformRepository = new PlatformRepository(array(), array(), $runtime);



        $expectations = array_map(function ($expectation) {

            return array_replace(array(null, array(), array()), (array) $expectation);

        }, $expectations);



        $libraries = array_map(
<?php     {

        $this->initCanvas();



        self::$canvas = array_replace(self::$canvas, $pixels);



        return $this;

    }