3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test($var) { echo "in function ",__FUNCTION__,"\n"; echo "Test: \$var == $var\n"; } class foo { public $arr = array("test"); function bar() { $this->arr[0]('some value'); } } $a = new foo(); $a->bar(); foo::hello(); var_dump(method_exists($a,'test'));
based on Gv8j9
Output for 7.0.0 - 7.2.0
in function test Test: $var == some value Fatal error: Uncaught Error: Call to undefined method foo::hello() in /in/tMrQP:21 Stack trace: #0 {main} thrown in /in/tMrQP on line 21
Process exited with code 255.
Output for 5.0.0 - 5.6.28
in function test Test: $var == some value Fatal error: Call to undefined method foo::hello() in /in/tMrQP on line 21
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tMrQP on line 10
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_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tMrQP on line 10
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/tMrQP on line 10
Process exited with code 255.