3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "Define a class...\n"; class ThisIsAContainer { public static function thisIsAMethod(){ echo "This method does something."; } } echo "Grab the method...\n"; $function = ThisIsAContainer::thisIsAMethod(...); echo "Run it:\n"; $function();
Output for 8.1.0 - 8.1.33, 8.2.21 - 8.2.29, 8.3.5 - 8.3.27, 8.4.1 - 8.4.14
Define a class... Grab the method... Run it: This method does something.
Output for 8.0.1 - 8.0.20
Parse error: syntax error, unexpected token ")" in /in/gtEi9 on line 13
Process exited with code 255.
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected ')' in /in/gtEi9 on line 13
Process exited with code 255.

preferences:
75.79 ms | 408 KiB | 5 Q