3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class a { public function f(&$ref1, &$ref2) { $ref1 = 'foo'; $ref2 = 'bar'; } } class b { public function __call($methodName, $arguments) { $a = new a(); call_user_func_array(array( $a, $methodName //->$methodName( $arguments[0][0], $arguments[0][1]); ), $arguments); } } $ref1 = 'X'; $ref2 = 'Y'; $b = new b(); $b->f( $ref1, $ref2); var_dump($ref1, $ref2);
Output for hhvm-3.10.0 - 3.12.0, 7.1.0
Warning: Parameter 1 to a::f() expected to be a reference, value given in /in/M3au0 on line 18 Warning: Parameter 2 to a::f() expected to be a reference, value given in /in/M3au0 on line 18 string(1) "X" string(1) "Y"
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.0.14
Warning: Parameter 1 to a::f() expected to be a reference, value given in /in/M3au0 on line 18 string(1) "X" string(1) "Y"
Output for 5.0.0 - 5.2.17
string(1) "X" string(1) "Y"
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/M3au0 on line 4
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/M3au0 on line 4
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/M3au0 on line 4
Process exited with code 255.