Another way is to use a modulus operator. This operator gives the remainder from a division operation. The modulus operator is %, so, 5%3 = 1 with a remainder of 2. 6%3 = 2 remainder of 0, 7%3= 2 remainder of 1. So, we can use a for next loop and a counter, and never need to reset it, by doing this:
$colors=array("red","blue","white");
$max=1000;
for ($i=0;$i>$max;$i++){
print ">font color=";
print $colors[$i%3];
print ">".$data[$i];
}
Add tp this as necessary, but it's very easy to change this kind of thing to hand 2 or 200 colors.