0 關注者

類別 yii\helpers\UnsetArrayValue

繼承關係yii\helpers\UnsetArrayValue
自版本起可用2.0.10
原始碼 https://github.com/yiisoft/yii2/blob/master/framework/helpers/UnsetArrayValue.php

在執行 yii\helpers\ArrayHelper::merge() 時,表示移除陣列值的物件。

使用範例

$array1 = [
    'ids' => [
        1,
    ],
    'validDomains' => [
        'example.com',
        'www.example.com',
    ],
];

$array2 = [
    'ids' => [
        2,
    ],
    'validDomains' => new \yii\helpers\UnsetArrayValue(),
];

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

結果將會是

[
    'ids' => [
        1,
        2,
    ],
]

公共方法

隱藏繼承的方法

方法 描述 定義於
__set_state() 在使用 var_export() 後還原類別狀態。 yii\helpers\UnsetArrayValue

方法詳情

隱藏繼承的方法

__set_state() public static method (自版本 2.0.16 起可用)

在使用 var_export() 後還原類別狀態。

另請參閱 https://php.dev.org.tw/manual/en/function.var-export.php

public static yii\helpers\UnsetArrayValue __set_state ( $state )
$state array

                public static function __set_state($state)
{
    return new self();
}