This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Tyson Ho
over 10 years

4/7 Parse error: syntax error, unexpected T_ENDWHILE, expecting ',' or ';'

Using Endwhile

Here is my PHP code

<!DOCTYPE html>
<html>
    <head>
        <title>A loop of your own</title>
        <link type='text/css' rel='stylesheet' href='style.css'/>
    </head>
    <body>
    <?php
    $loopcount = 10 ;
    while ($loopcount <= 100):
      $loopcount + $loopcount + 10;
      echo "<p> $loopcount is too small,unless the value is 100</p>"
    endwhile;
      echo "<p> it is 100 now.</p>";
    ?>
    </body>
</html>

Why I will get “Parse error: syntax error, unexpected T_ENDWHILE, expecting ‘,’ or ‘;’ on line 13 “

Answer 52bca87d52f86348ca000a47

1 vote

Permalink

It’s expecting a ‘;’ after echo “ $loopcount is too small,unless the value is 100” And right above that, I think you meant to write $loopcount = $loopcount + 10;

points
Submitted by Dannie Scull
over 10 years

2 comments

Tyson Ho over 10 years

thanks for your help :)

Dannie Scull over 10 years

You’re Welcome :)

Answer 54a22c629113cb2fd40152ff

1 vote

Permalink

change the value 100 to 90 and do the correction given by dannie scull

points
Submitted by Amy Kei
about 9 years