3v4l.org

run code in 200+ PHP versions simultaneously
<?php function ref( &$ref ) { var_dump( $ref ); } $func = 'ref'; $foo = 'native'; ref( $foo ); $foo = 'variable'; $func( $foo ); $foo = 'call_user_func_array'; call_user_func_array( $func, array( &$foo ) ); $foo = 'call_user_func'; call_user_func( $func, $foo );
Output for 7.1.0 - 7.3.1
string(6) "native" string(8) "variable" string(20) "call_user_func_array" Warning: Parameter 1 to ref() expected to be a reference, value given in /in/fESuN on line 16 string(14) "call_user_func"
Output for 4.3.0 - 5.2.17, 7.0.0 - 7.0.8, 7.0.20
string(6) "native" string(8) "variable" string(20) "call_user_func_array" string(14) "call_user_func"
Output for 5.3.0 - 5.6.24, 7.0.9
string(6) "native" string(8) "variable" string(20) "call_user_func_array" Warning: Parameter 1 to ref() expected to be a reference, value given in /in/fESuN on line 16