I am trying to set a variable based on some maths logic (to wrap specific html around elements).
I worked half the problem, to hit 0, 3, 6, 9, 12
if(($i % 3) == 0) { // blah }
Now I need to hit the following numbers, 2, 5, 8, 11, 14, etc
What possible maths operation could I do to hit this sequence?
Modulo returns the remainder, so when you match the 0, you get the 3rd, 6th, 9th, etc, because 0 is left in the division.
So just check for when 1 remains and 2 remains.