3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class PropertyTest { public function __set($name, $value) { echo "Setting '$name' to '$value'\n"; $this->data[$name] = $value; } public function __get($name) { echo "Getting '$name'\n"; if (array_key_exists($name, $this->data)) { return $this->data[$name]; }}} echo "<pre>\n"; $obj = new PropertyTest; $obj->a = 1; echo $obj->a . "\n\n"; ?>
Output for 5.3.0 - 7.1.0
<pre> Setting 'a' to '1' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists() expects parameter 2 to be array, null given in /in/WKL9N on line 13 Notice: Indirect modification of overloaded property PropertyTest::$data has no effect in /in/WKL9N on line 8 Getting 'a' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists() expects parameter 2 to be array, null given in /in/WKL9N on line 13 Warning: array_key_exists() expects parameter 2 to be array, null given in /in/WKL9N on line 13
Output for 5.2.6 - 5.2.17
<pre> Setting 'a' to '1' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13 Notice: Indirect modification of overloaded property PropertyTest::$data has no effect in /in/WKL9N on line 8 Getting 'a' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13
Output for 5.2.1 - 5.2.5
<pre> Setting 'a' to '1' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13 Notice: Indirect modification of overloaded property PropertyTest::$data has no effect in /in/WKL9N on line 8 Getting 'a' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13
Output for 5.1.0 - 5.2.0
<pre> Setting 'a' to '1' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13 Getting 'a' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13
Output for 5.0.4 - 5.0.5
<pre> Setting 'a' to '1' Getting 'data' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13 Getting 'a' Notice: Undefined property: PropertyTest::$data in /in/WKL9N on line 13 Warning: array_key_exists(): The second argument should be either an array or an object in /in/WKL9N on line 13
Output for 5.0.0 - 5.0.3
<pre> Setting 'a' to '1' Fatal error: Cannot access undefined property for object with overloaded property access in /in/WKL9N on line 8
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/WKL9N 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/WKL9N 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/WKL9N on line 5
Process exited with code 255.