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.33, 8.2.21 - 8.2.29, 8.3.5 - 8.3.25, 8.4.1 - 8.4.12
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:
49.47 ms | 408 KiB | 5 Q