3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Testme { public static function foo(&$ref) { $ref = 1; } } class Invoker { public static function invoke($func_name) { $trace = debug_backtrace(); $args = $trace[1]['args']; call_user_func_array(array('Testme', $func_name), $args); } } $test = 2; $testRef = &$test; Invoker::invoke('foo', $testRef); var_dump($test);
Output for 5.3.28 - 5.3.29, 5.4.18 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: 1 in /in/1KURo on line 11 Warning: call_user_func_array() expects parameter 2 to be array, null given in /in/1KURo on line 12 int(2)
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: 1 in /in/1KURo on line 11 Warning: foo() expects exactly 1 parameter, 0 given in /in/1KURo on line 4 int(2)
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17
Notice: Undefined offset: 1 in /in/9lK91 on line 11 Warning: call_user_func_array() expects parameter 2 to be array, null given in /in/9lK91 on line 12 int(2)
Output for 5.0.0 - 5.2.17
Notice: Undefined offset: 1 in /in/9lK91 on line 11 Warning: Missing argument 1 for Testme::foo() in /in/9lK91 on line 3 int(2)
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/9lK91 on line 3
Process exited with code 255.
Output for 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/9lK91 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/9lK91 on line 3
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/1KURo on line 3
Process exited with code 255.