<?
$row_color = array('red','green');
$color_index = 0;
$meal = array('breakfast' => 'A',
'lunch' => 'B',
'snack' => 'C',
'dinner' => 'D');
print "<table>\n";
foreach ($meal as $key => $value) {
print '<tr bgcolor="' . $row_color[$color_index] . '">';
print "<td>$key</td><td>$value</td></tr>\n";
$color_index = 1 - $color_index;
}
print '</table>';
?>
|