- property_exists: documentation ( source)
- var_dump: documentation ( source)
<?php
class Notify {
protected int $id;
public function __set($name, $value)
{
echo __METHOD__ . PHP_EOL;
if (property_exists($this, $name)) {
$this->{$name} = $value;
}
return $this;
}
}
$obj = new Notify();
$obj->id = 1;
var_dump($obj);