I am using a for loop to create a grid of items in a three by X pattern. Each column of items needs to have different properties but I am struggling to fin a solution to accurately select the correct items. Currently I have been trying to use Mod %.
An example of what I am trying to achieve:
[Red] [Blue] [Green]
[Red] [Blue] [Green]
[Red] [Blue] [Green]
[Red] [Blue] [Green] etc
I have been using switch to try to achieve this:
for($i = 1; $i <= 20; $i++) {
switch($i) {
case ($i % 3 == 0):
/* Do column three*/
break;
case ($i % 2 == 0):
/* Do column two*/
break;
Default:
/* Do column one*/
break;
}
}
The problem is that each column doesn't work out to be a multiple of the same number each time, and I don't want to try to include a case for every possibility.
Is there a way to simply achieve this?