# Delete property from object php (ok)

Ví dụ 1:

```
<?php
$var     = (object) ['a' => 1];
unset($var->a);
echo $var->a;
?>
```

![](https://929787348-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRtlBk287z48lyi_B98%2F-MZgOV-aeW0bkwrF_E_S%2F-MZgPrgVB5g5JVd4tbtd%2FScreenshot_4.jpg?alt=media\&token=6e76f9ee-15b1-44a8-962d-e133206e82da)

Ví dụ 2:

![](https://929787348-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRtlBk287z48lyi_B98%2F-MZgOV-aeW0bkwrF_E_S%2F-MZgQ5FPvKyk1_KUMD2n%2FScreenshot_5.jpg?alt=media\&token=08e1c531-ce16-43ef-a980-ff688c510b57)

```
<?php
$var     = (object) ['a' => 1];
// unset($var->a);
echo $var->a;
?>
```
