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)); echo "--------\n"; $cuf($f, array(1)); var_dump($a, array(1)); echo "--------\n"; call_user_func_array($f, $a); var_dump($a, array(1)); echo "--------\n"; call_user_func_array($f, array(1)); var_dump($a, array(1)); echo "--------\n"; } test('call_user_func_array', 'foo');
Output for 7.1.0
Warning: Parameter 1 to foo() expected to be a reference, value given in /in/G02CA 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/G02CA on line 9 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/G02CA on line 12 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/G02CA on line 15 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/G02CA 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/G02CA on line 9 array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } -------- Warning: Parameter 1 to foo() expected to be a reference, value given in /in/G02CA on line 12 array(1) { [0]=> int(1) } array(1) { [0]=> int(1) } -------- Warning: Parameter 1 to foo() expected to be a reference, value given in /in/G02CA on line 15 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/G02CA 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/G02CA on line 12 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) } --------