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

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for branch php-master
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 branch php-master+jit
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 branch php-master+opcache
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

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page