A conditional loop to display all the even numbers between 30 and 40

Hi there!

I’m REALLY new to php and I’ve been thrown pretty much in the deep end of it.

I need a code that states all the even numbers between 30 and 40 using a conditional loop.

Would love a response! :slight_smile:

Not tested it, but if it doesn’t work let me know and I will!

[php]for($i=30;$i<=40;$i++)
{
if($i%2 == 0)
{
echo $i.’
’;
}
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service