3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(1,2,4,5,7); $zero = array(0); $length = 8; for ($i=0; $i < $length; $i++){ if ($a[$i] > $i + 1){ array_splice($a, 3, 0, $zero); } } var_dump($a);
Output for 5.3.0 - 7.1.0
Notice: Undefined offset: 7 in /in/RBRuh on line 8 array(7) { [0]=> int(1) [1]=> int(2) [2]=> int(4) [3]=> int(0) [4]=> int(0) [5]=> int(5) [6]=> int(7) }
Output for 4.3.0 - 5.2.17
Notice: Undefined offset: 7 in /in/RBRuh on line 8 array(7) { [0]=> int(1) [1]=> int(2) [2]=> int(4) [3]=> int(0) [4]=> int(0) [5]=> int(5) [6]=> int(7) }