3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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));
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
bool(false) isset x ( returns 0 )bool(false) set x = 42 bool(true) bool(true)
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function property_exists() in /in/ZTQJB on line 25
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ZTQJB on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ZTQJB on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/ZTQJB on line 5
Process exited with code 255.