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($blue); $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 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<pre>Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 )