1 2 3 4 5 6 7 8 9 10 11 12 13
<?php $array = range(0, 8); $result = array(); for ($i = 0; $i < 3; $i++) { for ($j = $i; isset($array[$j]); $j += 3) { $result[] = $array[$j]; } } print_r($result);
1 2 3 4 5 6 7 8 9 10 11 12
Array ( [0] => 0 [1] => 3 [2] => 6 [3] => 1 [4] => 4 [5] => 7 [6] => 2 [7] => 5 [8] => 8 )