3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function byVal($arg) { echo 'As passed : ', var_export(func_get_args()), PHP_EOL; $arg = 'baz'; echo 'After change : ', var_export(func_get_args()), PHP_EOL; } function byRef(&$arg) { echo 'As passed : ', var_export(func_get_args()), PHP_EOL; $arg = 'baz'; echo 'After change : ', var_export(func_get_args()), PHP_EOL; } $arg = 'bar'; byVal($arg); byRef($arg); ?>
Output for 7.0.0 - 7.2.0
As passed : array ( 0 => 'bar', ) After change : array ( 0 => 'baz', ) As passed : array ( 0 => 'bar', ) After change : array ( 0 => 'baz', )
Output for 5.3.20 - 5.6.21
As passed : array ( 0 => 'bar', ) After change : array ( 0 => 'bar', ) As passed : array ( 0 => 'bar', ) After change : array ( 0 => 'baz', )