Can someone explain to me to the logic behind the %2. Although I do know the variable $i is changing every time it loops. I'd like to know what the %2 means.
PHP Code:
$i=0;
while($i < 10){
if($i%2){
$color = 'class="blue"';
}
else{
$color = 'class="red"';
}
echo '<h2 '.$color.'>Text</h2>';
$i++;
}
|