helpers\UnsetArrayValue

All Classes
Inheritance yii\helpers\UnsetArrayValue
Available since version 2.0.10
Source Code https://github.com/yiisoft/yii2/blob/master/framework/helpers/UnsetArrayValue.php

Object that represents the removal 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\UnsetArrayValue(),
];

$result = \yii\helpers\ArrayHelper::merge($array1, $array2);

The result will be

[
    'ids' => [
        1,
        2,
    ],
]
doc_Yii
2016-10-30 17:05:47
Comments
Leave a Comment

Please login to continue.