3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private static $var = 1; public __get($name) { return $this->$name; } public __set($name, $value) { $this->$name = $value; } } $f = new Foo; echo $f->var; $f->var = 2; echo $f->var; var_dump($f);
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '__get' (T_STRING), expecting variable (T_VARIABLE) in /in/sme28 on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/sme28 on line 7
Process exited with code 255.

preferences:
182.7 ms | 1399 KiB | 61 Q