array_replace
laravel/framework
Supported Versions: PHP 5 >= 5.3.0, PHP 7, PHP 8
Replaces elements from passed arrays into the first array
array_replace
(array
$array
, array ...
$replacements
): array
public function
replace
(
$items
)
{
return new static(
array_replace
(
$this
->
items
,
$this
->
getArrayableItems
(
$items
)));
}
src/Illuminate/Collections/Collection.php
$symfonyRequest
=
SymfonyRequest
::
create
(
$this
->
prepareUrlForRequest
(
$uri
),
$method
,
$parameters
,
$cookies
,
$files
,
array_replace
(
$this
->
serverVariables
,
$server
),
$content
);
$response
=
$kernel
->
handle
(
src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
$fields
=
array_fill_keys
(
$matches
[
0
],
null
);
$route
->
setBindingFields
(
array_replace
(
$fields
,
array_intersect_key
(
$bindingFields
,
$fields
)
));
}
src/Illuminate/Routing/ResourceRegistrar.php
return
false
;
}
[
$numerator
,
$denominator
] =
array_replace
(
[
1
,
1
],
array_filter
(
sscanf
(
$parameters
[
'ratio'
],
'%f/%d'
))
);
$precision
=
1
/ (
max
(
$width
,
$height
) +
1
);
src/Illuminate/Validation/Concerns/ValidatesAttributes.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
);
tests/Http/Middleware/TrustProxiesTest.php