Well, here's something I just scratched together that you can probably use. The key is in this line:
if($j == count($array)) {
$j = 0;
}
It just checks if we're at the end of the array, then resets it.
Three variables:
$z is the outside count. We want $z sets of numbers.
$i is the inside count. There should be $i numbers in a set.
$j is the key from the array.
$array = range(0, 12);
for($z=0;$z<10;$z++) {
for($i=0;$i<3;$i++) {
echo $array[$j]." ";
$j++;
if($j == count($array)) {
$j = 0;
}
}
echo "... ";
}