3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(-1); function foo(&$a) { var_dump($a++); } function test($cuf, $f) { $a = array(1); $cuf($f, $a); var_dump($a, array(1)); $cuf($f, array(1)); var_dump($a, array(1)); call_user_func_array($f, $a); var_dump($a, array(1)); call_user_func_array($f, array(1)); var_dump($a, array(1)); } test('call_user_func_array', 'foo');
Output for hhvm-3.10.0 - 3.12.0, 7.1.0
Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 6 int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 8 int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 10 int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 12 int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) }
Output for 7.0.0 - 7.0.14
Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 6 array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 8 array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 10 array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 12 array(1) { [0]=> int(1) } array(1) { [0]=> int(1) }
Output for 5.3.0 - 5.6.28
Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 6 array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } Warning: Parameter 1 to foo() expected to be a reference, value given in /in/TuVLV on line 10 array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) }
Output for 4.3.0 - 5.2.17
int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } int(1) array(1) { [0]=> int(1) } array(1) { [0]=> int(1) }