This forum is now read-only. Please use our new forums at discuss.codecademy.com.

For Loops in PHP Forum

View Course » View Exercise

27 points
Picture
Submitted by
Patrick Kelly
over 4 years ago

answer to loop question 2

i have played with fors i have added i++ i have done this that and other,i am lost.<?php
// Echoes the first five even numbers
for__ ($i = 0; $i < 11; $i = $i + 2) i++___
echo $i;
___
?>


0 votes

permalink

You simply need to replace the underscores with the proper for-loop syntax:

for (expression 1; expression 2; expression 3) {
    // code to be executed
}

http://php.net/manual/en/control-structures.for.php

1912 points
52565eeb80ff337232001e7d_158831513
Submitted by
brennanpringle_4f151ba89c99ab0001018
about 4 years ago