3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function public() { return function() { $this->private(); } } private function private() { return 'works'; } } $test = new Test; echo $test->public();
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting identifier (T_STRING) in /in/2FiII on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_PUBLIC, expecting T_STRING in /in/2FiII on line 5
Process exited with code 255.

preferences:
190.75 ms | 1395 KiB | 67 Q