類別 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,
],
]
方法詳情
在使用 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();
}
註冊 或 登入 以進行評論。