Forum Moderators: coopster
How do I change a value every N times in a loop? I know there's probably a simple formula using modulus, but I can't get my head around it today.
for instance, what condition do I put in the "if" in the situation below?
count=0;
while (whatever){
if ( what do i put here? ){
$bgcolor='#ffffff';
}else{
$bgcolor='#ffcccc';
}
print("<TR><TD bgcolor='".$bgcolor."'> lorem ipsum </TD></TR>");
$count++;
}
I want the result to look like: N rows of one color, then N rows of a second color, then N rows of the first color again, etc.
I'll be willing to bet that Timotheos' bitwise operator is faster though...