3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [1, 2, 3]; foreach ($arr as &$num) { var_dump($num); $arr[3] = 4; } echo "\n\n====\n\n"; $arr = [1, 2, 3]; foreach ($arr as $num) { var_dump($num); $arr[3] = 4; }
Output for 5.4.10 - 7.3.1
int(1) int(2) int(3) int(4) ==== int(1) int(2) int(3)
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ea1jo on line 3
Process exited with code 255.