Q: How can I output alternate values from a set of values-list?
A:
1. Just loop through your values-list array:
<?php
$values_arr = array('A', 'B', 'C', 'D');
for($i=0; $i<10; ++$i)
{
$value = current($values_arr) and next($values_arr) or
reset($values_arr);
echo $value;
}
?>
2. If you want just to flip-flop between two integers, use XOR logic:
<?php
$flip_num = 1;
$flop_num = 5;
for($i=0, $n=$flip_num; $i<10; ++$i, $n ^= ($flip_num^$flop_num))
echo $n;
?>
The idea may be incorporated to echo a HTML table with alternate row
colors, row styles (using CSS class), etc.
++++++
@todo Better wording. Grammar cleanup. Someone may help.