How about this:
<?php
$cnt=0;
$bgCols=Array('green','red','blue','yellow');
// Make a few test items
$items=Array();
for ($x=1;$x<16;$x++)
$items[]="Item $x";
// Start table
echo "<table>\n";
foreach($items as $item)
{
echo "<tr bgcolor=\"$bgCols[$cnt]\">\n<td>$item</td>\n</tr>\n";
$cnt+1==count($bgCols) ? $cnt=0 : $cnt++;
}
echo "</table>\n";
?>