3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { private $fooId; private $fooName; public void __set($name, $value) { $this->$name = $value; } public function __get($name) { if (self::__isset($name)) { return $this->$name; } $trace = debug_backtrace(); trigger_error( 'Undefined property via __get(): ' . $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);
Output for 5.4.0 - 5.4.14
Parse error: syntax error, unexpected 'void' (T_STRING), expecting variable (T_VARIABLE) in /in/5GdO3 on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.24
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/5GdO3 on line 7
Process exited with code 255.