Hi all, firstly thank you for taking the time to read this thread. It is probably easy to resolve for some but I can not seem to get head around it.
I have $i which starts at 1. On each return of a loop it increments and every 4 increments it prints out a variable to the screen.
So here is the code that I am currently using:
while($i < 48) {
if($i == 4 || $i == 8 || $i == 12 || $i == 16 || $i == 20 || $i == 24 || $i == 28 || $i == 32 || $i == 36 || $i == 40 || $i == 44) {
echo 'YAY, another 4';
}
$i++;
}
Obviously this is not very dynamic and I do not want to have a never ending if statement which has to be constantly increased. Is there a cleaner more efficient way of doing this?
Any help you can offer will be massively appreciated.