3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function __get($name) { $pos = strpos($name, '#'); if ($pos !== false && $pos != 0 ) { $func = substr($name, 0, $pos); return $this->$func(); } else { return $name; } } private function a() { return "f:a"; } } $a = new A(); echo $a->a; echo $a->a#a;
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/gBXVT on line 21
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected $end, expecting ',' or ';' in /in/gBXVT on line 21
Process exited with code 255.

preferences:
184.01 ms | 1394 KiB | 57 Q