So here is the template I'm looking for
from the final set, I want to get the first 2 values for one set, then the following 4 for another set, then 2 for this first set, and then 4 for another set, etc.
grab 2 | grab 4 | grab 2 | grab 4 ...
$count = 0;
foreach ($listing as $entry){
if ($count % 4 == 0){
} else if ($count % 2 == 0){
}
$count++;
}
My confusion is that when $ count% 4 = 0, then $ count% 2 will also be = 0.
So I have to be safe before reaching the wrong module case (since both are true for any arbitrary number divisible by 4) by checking first if $ count% 4 == 0?
source
share