3v4l.org

run code in 200+ PHP versions simultaneously
<?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 ); // Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func( $callback, $a ); // Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func( $callback, ...$b ); // Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func( $callback, ...$c ); // Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func_array( $callback, array( true ) ); // Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func_array( $callback, array( $a ) ); // Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func_array( $callback, $b ); // 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
based on 4fEA9
Output for 7.1.0 - 7.4.0
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 20 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 21 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 22 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 23 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 25 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe 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/20WRe on line 22 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 23 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 25 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 26
Output for 7.0.9
Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 21 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 22 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 23 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 25 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe 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/20WRe on line 22 Warning: Parameter 1 to my_callback() expected to be a reference, value given in /in/20WRe on line 27
Output for 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '.' in /in/20WRe on line 12
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.4.45
Parse error: syntax error, unexpected '.', expecting ')' in /in/20WRe on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '.', expecting ')' in /in/20WRe on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/20WRe on line 12
Process exited with code 255.