3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $blue = array(1,4,7,10); $red = array(2,3,5,6,8,9); $final_array = array(); for($i=0; $i<sizeof($blue); $i++) { if($i < sizeof($blue)) { $final_array[] = $blue[$i]; } if($i < sizeof($red)) { $final_array[] = $red[$i*2]; $final_array[] = $red[($i*2)+1]; } } echo '<pre>'; print_r($final_array);
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: 6 in /in/ng8YX on line 16 Notice: Undefined offset: 7 in /in/ng8YX on line 17 <pre>Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] => [11] => )
Output for hhvm-3.12.0
Notice: Undefined index: 6 in /in/ng8YX on line 16 Notice: Undefined index: 7 in /in/ng8YX on line 17 <pre>Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] => [11] => )
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.2.17
Notice: Undefined offset: 6 in /in/ng8YX on line 16 Notice: Undefined offset: 7 in /in/ng8YX on line 17 <pre>Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] => [11] => )