3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { function foo($a = 1) { echo __METHOD__;} static function bar($a = 1) { echo __METHOD__;} } $x = new x(); $x->foo(); // classic method call $x::bar(); // static method call on object X::bar(); // static method call on class name ?>
Output for 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1
x::foox::barx::bar
Output for 4.3.0
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/NsId6 on line 5
Process exited with code 255.

preferences:
36.09 ms | 406 KiB | 5 Q