bradgrafelman wrote:What you're asking doesn't make sense.
Is $var being changed within the for() loop? If not, it will always be either <= or > than 6, so the for() loop will either run for an infinite amount of time or not at all.
I don't want to change $var within the loop.
Please forget that and I'll try to explain a different way.
for ($i = 0; $i < $var; $i++) {
...
}
I want the above loop to execute a maximum of 6 times. So, if $var = 1, 2, 3, 4, 5 or 6, there is no problem. But if $var = 7 or more, there is a problem.
How do I limit the number of loop executions to 6?