3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { private $data = array(); public function __get($key) { echo "get $key\n"; return $this->data[$key]; } public function __set($key, $value) { echo "set $key = $value\n"; $this->data[$key] = $value; } public function __isset($key) { return isset($this->data[$key]); } } $test = new test(); var_dump(property_exists($test, 'x')); var_dump(isset($test->x)); $test->x = 42; var_dump(property_exists($test, 'x')); var_dump(isset($test->x));

preferences:
26.62 ms | 402 KiB | 5 Q