ReplaceArrayValue
in package
Object that represents the replacement of array value while performing [[ArrayHelper::merge()]].
Usage example:
$array1 = [
'ids' => [
1,
],
'validDomains' => [
'example.com',
'www.example.com',
],
];
$array2 = [
'ids' => [
2,
],
'validDomains' => new \yii\helpers\ReplaceArrayValue([
'yiiframework.com',
'www.yiiframework.com',
]),
];
$result = \yii\helpers\ArrayHelper::merge($array1, $array2);
The result will be
[
'ids' => [
1,
2,
],
'validDomains' => [
'yiiframework.com',
'www.yiiframework.com',
],
]
Tags
Table of Contents
Properties
- $value : mixed
Methods
- __construct() : mixed
- Constructor.
- __set_state() : ReplaceArrayValue
- Restores class state after using `var_export()`.
Properties
$value
public
mixed
$value
value used as replacement.
Methods
__construct()
Constructor.
public
__construct(mixed $value) : mixed
Parameters
- $value : mixed
-
value used as replacement.
__set_state()
Restores class state after using `var_export()`.
public
static __set_state(array<string|int, mixed> $state) : ReplaceArrayValue
Parameters
- $state : array<string|int, mixed>