3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = [0, 1, 2]; unset($x[2]); $y = $x; $x[] = 'new'; $y[] = 'new'; var_dump($x); var_dump($y);
Output for 5.4.34 - 5.4.45, 5.5.18 - 5.5.38, 5.6.1 - 7.3.0
array(3) { [0]=> int(0) [1]=> int(1) [3]=> string(3) "new" } array(3) { [0]=> int(0) [1]=> int(1) [3]=> string(3) "new" }
Output for 5.4.9 - 5.4.32, 5.5.0 - 5.5.17, 5.6.0
array(3) { [0]=> int(0) [1]=> int(1) [2]=> string(3) "new" } array(3) { [0]=> int(0) [1]=> int(1) [3]=> string(3) "new" }
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Dv6ct on line 3
Process exited with code 255.