3v4l.org

run code in 200+ PHP versions simultaneously
<?php function ref(&$a) { var_dump($a); } $b = 1; $args = array( &$b ); unset($b); for ($i = 0; $i < 2; $i++) { $a = array_slice($args, 0, 1); call_user_func_array('ref', $a); }
based on eR6OM
Output for 7.1.0 - 7.3.1
Warning: Parameter 1 to ref() expected to be a reference, value given in /in/WECs1 on line 10 int(1) Warning: Parameter 1 to ref() expected to be a reference, value given in /in/WECs1 on line 10 int(1)
Output for 7.0.0 - 7.0.20
int(1) Warning: Parameter 1 to ref() expected to be a reference, value given in /in/WECs1 on line 10
Output for 5.3.0 - 5.6.24
Warning: Parameter 1 to ref() expected to be a reference, value given in /in/WECs1 on line 10 Warning: Parameter 1 to ref() expected to be a reference, value given in /in/WECs1 on line 10
Output for 4.3.0 - 5.2.17
int(1) int(1)