0 follower

Class yii\helpers\ReplaceArrayValue

Inheritanceyii\helpers\ReplaceArrayValue
Available since version2.0.10
Source Code https://github.com/yiisoft/yii2/blob/master/framework/helpers/ReplaceArrayValue.php

Object that represents the replacement of array value while performing yii\helpers\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',
    ],
]

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$value mixed Value used as replacement. yii\helpers\ReplaceArrayValue

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. yii\helpers\ReplaceArrayValue

Property Details

$value public property

Value used as replacement.

public mixed $value null

Method Details

__construct() public method

Constructor.

public void __construct ( $value )
$value mixed

Value used as replacement.