I'm showing data from a db table and I can loop through 2 background colours pretty easily, but how can I expand that to incorporate 3 or possibly 4 background colours??

Currently I have this code for the two css classes:

php echo $i++ % 2 ? 'class="even"' : 'class="odd"'; 

Many thanks