3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class x { static function foo() { print "foo"; } function bar() { $x = array(get_class(), "foo"); call_user_func($x); $x(); } } $a = new x; $a->bar(); ?>
based on pqZdR
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
foofoo
Output for 5.0.0 - 5.1.1, 5.1.3 - 5.3.29
foo Fatal error: Function name must be a string in /in/LRLcf on line 9
Process exited with code 255.
Output for 5.1.2
Strict Standards: Non-static method x::foo() cannot be called statically, assuming $this from compatible context x in /in/LRLcf on line 8 foo Fatal error: Function name must be a string in /in/LRLcf on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/LRLcf on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/LRLcf on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/LRLcf on line 3
Process exited with code 255.