3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = ['apple']; $test =& $foo; $bar = $foo; $bar[0] = 'orange'; var_dump($test[0]); $foo = ['apple']; $bar = $foo; $test =& $foo[0]; $bar[0] = 'orange'; var_dump($test); $foo = ['apple']; $test =& $foo[0]; $bar = $foo; $bar[0] = 'orange'; var_dump($test);
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
string(5) "apple" string(5) "apple" string(6) "orange"