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

While Loops in PHP Forum

View Course » View Exercise

1634 points
Submitted by
Bill Hinostroza
about 4 years ago

4/7 Parse error: syntax error, unexpected '<'

I get an error message but I still pass?

Here is my code

        //Add while loop below
        $num1 = 0;
        while($num1 =< 10):
            echo  $num1 . " <br/>";
            $num1 ++;

and here is the error

Parse error: syntax error, unexpected
'<' on line 11 >

What gives?

2 votes


Your while statement should be while($num1 <= 10): the '<' goes before the '='.

168 points
Submitted by
Dannie Scull
about 4 years ago