3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a=array(1, 2, 3, 4, 5); foreach($a as $b) { $a[$b]++; } var_dump($a); foreach($a as $b) { $a[$b]++; } var_dump($a);
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: 5 in /in/qBAbA on line 4 array(6) { [0]=> int(1) [1]=> int(3) [2]=> int(4) [3]=> int(5) [4]=> int(6) [5]=> int(1) } Notice: Undefined offset: 6 in /in/qBAbA on line 10 array(7) { [0]=> int(1) [1]=> int(5) [2]=> int(4) [3]=> int(6) [4]=> int(7) [5]=> int(2) [6]=> int(1) }
Output for hhvm-3.12.0
array(6) { [0]=> int(1) [1]=> int(3) [2]=> int(4) [3]=> int(5) [4]=> int(6) [5]=> int(1) } array(7) { [0]=> int(1) [1]=> int(5) [2]=> int(4) [3]=> int(6) [4]=> int(7) [5]=> int(2) [6]=> int(1) }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.2.17
Notice: Undefined offset: 5 in /in/qBAbA on line 4 array(6) { [0]=> int(1) [1]=> int(3) [2]=> int(4) [3]=> int(5) [4]=> int(6) [5]=> int(1) } Notice: Undefined offset: 6 in /in/qBAbA on line 10 array(7) { [0]=> int(1) [1]=> int(5) [2]=> int(4) [3]=> int(6) [4]=> int(7) [5]=> int(2) [6]=> int(1) }