Skip to content
PHP Ecosystem
Explore

UnsetArrayValue

API reference › yii › helpers › UnsetArrayValue

classyii\helpers\UnsetArrayValue
Since2.0.10
Sourceframework/helpers/UnsetArrayValue.php

Object that represents the removal 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\UnsetArrayValue(),
];
$result = \yii\helpers\ArrayHelper::merge($array1, $array2);

The result will be

[
'ids' => [
1,
2,
],
]
MethodDescriptionDefined by
__set_state() staticRestores class state after using var_export().UnsetArrayValue
public static function __set_state(array $state): yii\helpers\UnsetArrayValue

Restores class state after using var_export().

Parameters

ParameterTypeDescription
$statearray

Returns

UnsetArrayValue

Since

2.0.16

See also