3v4l.org

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