3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { private $data = array(); public function __get($key) { echo "get $key\n"; return $$key; } public function __set($key, $value) { echo "set $key = $value\n"; $this->$key = $value; } public function __isset($key) { echo sprintf("isset $key ( returns %b )", isset($this->$key)); return isset($this->$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));<?php
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '<' in /in/Q2K44 on line 31
Process exited with code 255.

preferences:
182.77 ms | 1387 KiB | 65 Q