<?php
function my_callback( &$param ) {}
$callback = 'my_callback';
$a = true;
$b = array( $a );
$c = array( &$a );
//my_callback( true ); // Fatal error: passing a value when reference is expected.
my_callback( $a ); // OK
my_callback( ...$b ); // OK
my_callback( ...$c ); // OK
//$callback( true ); // Fatal error: passing a value when reference is expected.
$callback( $a ); // OK
$callback( ...$b ); // OK
$callback( ...$c ); // OK
call_user_func( $callback, true ); // PHP 7.1+: Warning: Parameter 1 to my_callback() expected to be a reference, value given
call_user_func( $callback, $a ); // PHP 7.1+: Warning: Parameter 1 to my_callback() expected to be a reference, value given
call_user_func( $callback, ...$b ); // PHP 5.6+: Warning: Parameter 1 to my_callback() expected to be a reference, value given
call_user_func( $callback, ...$c ); // PHP 7.0+: Warning: Parameter 1 to my_callback() expected to be a reference, value given
call_user_func_array( $callback, array( true ) ); // PHP 7.0+: Warning: Parameter 1 to my_callback() expected to be a reference, value given
call_user_func_array( $callback, array( $a ) ); // PHP 7.0+: Warning: Parameter 1 to my_callback() expected to be a reference, value given
call_user_func_array( $callback, $b ); // PHP 5.6: Warning: Parameter 1 to my_callback() expected to be a reference, value given
call_user_func_array( $callback, array( &$a ) ); // OK
call_user_func_array( $callback, $c ); // OK
Warning: my_callback(): Argument #1 ($param) must be passed by reference, value given in /in/AfX8n on line 20
Warning: my_callback(): Argument #1 ($param) must be passed by reference, value given in /in/AfX8n on line 21
Warning: my_callback(): Argument #1 ($param) must be passed by reference, value given in /in/AfX8n on line 22
Warning: my_callback(): Argument #1 ($param) must be passed by reference, value given in /in/AfX8n on line 23
Warning: my_callback(): Argument #1 ($param) must be passed by reference, value given in /in/AfX8n on line 25
Warning: my_callback(): Argument #1 ($param) must be passed by reference, value given in /in/AfX8n on line 26
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 20
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 21
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 22
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 23
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 25
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 26
Output for 7.0.0 - 7.0.8, 7.0.10 - 7.0.33
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 22
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 23
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 25
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 26
Output for 7.0.9
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 21
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 22
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 23
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 25
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 26
Output for 5.6.0 - 5.6.40
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 22
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/AfX8n on line 27
Output for 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '.' in /in/AfX8n on line 12
Process exited with code 255.