3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $fooId; private $fooName; public function __set($name, $value) { $this->$name = $value; } public function __get($name) { if (self::__isset($name)) { return $this->$name; } $trace = debug_backtrace(); trigger_error( 'Undefined property ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE); return null; } public function __isset($name) { return isset($this->$name); } } $bar = new Foo(); $bar->fooId = 2; $bar->fooName = 'Name'; var_dump($bar); printf($bar->check);

preferences:
39.27 ms | 402 KiB | 5 Q