3v4l.org

run code in 500+ 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.34, 8.2.21 - 8.2.30, 8.3.5 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
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:
59.32 ms | 969 KiB | 4 Q