3v4l.org

run code in 300+ 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 ); // 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
Output for git.master, git.master_jit, rfc.property-hooks
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

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

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


preferences:
71.07 ms | 407 KiB | 5 Q