If loop question

I’m wondering if there’s an "If … and … " function for PHP.

Essentially, I’d like a few lines of code to repeat if i is greater that 1 and less than 7.

There’s no such thing as an if loop. The loops are goto loops, while loops or for loops.

if is not a loop. You can use while or for loop inside the if condition to achieve your task[php]
if($i>=1 && $i<=7)
{
//you can use for or while loop here

}

[/php]

Why would you do that?
[php]
while ($i>=1 && $i<=7) {
//Insert what to do here
}[/php]

Assuming he want to repeat certain codes if $i is between 1 and 7. Say he want to loop 5 times if $i is between1 to 7.

Yes, if he just want to loop 1 to 7 , what you have suggested is perfect.

Did you accidently post that in another topic as well?

Ohh I was thinking where my post went. Please delete that.

Sponsor our Newsletter | Privacy Policy | Terms of Service