3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { $fn = static::methodName(...); if (is_callable($fn)) { $fn(); } } } (new Foo())->bar();
Output for 8.1.0 - 8.1.6
Fatal error: Uncaught Error: Call to undefined method Foo::methodName() in /in/m29BK:5 Stack trace: #0 /in/m29BK(12): Foo->bar() #1 {main} thrown in /in/m29BK on line 5
Process exited with code 255.
Output for 8.0.1 - 8.0.19
Parse error: syntax error, unexpected token ")" in /in/m29BK on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.29
Parse error: syntax error, unexpected ')' in /in/m29BK on line 5
Process exited with code 255.

preferences:
183.44 ms | 1395 KiB | 61 Q