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

0 points
Submitted by Roelof Wobben
over 10 years

Parse error: syntax error, unexpected T_VARIABLE, expecting '(' on line 13

Hello,

I have this code :

<?php
  $loopCond = false;
  do 
{
                echo "<p>The loop ran even though the loop condition is false.</p>";
} 
   while $loopCond ;
   echo "<p>Now the loop is done running.</p>" ;
   ?>

And see this error message : Parse error: syntax error, unexpected T_VARIABLE, expecting ‘(‘ on line 13

I do not see the error I made.

Can someone help me ?

Roelof

Answer 5216230d548c3528e70036a8

0 votes

Permalink

I don’t know why your indentation looks messed up there, but try this:

  • Reset the code, and start again.
  • Set your “while-conditions” within ( ) brackets… this is important!

And then there is a slight hiccup with the course in that while ‘true’, you have to echo:

“The loop is running.”

Exactly as typed or it will fail

points
Submitted by Rashaad Essop
over 10 years

1 comments

Fábio Freire over 10 years

the echo “

The loop is running.

“; is from exercise 1.2 its seems that the doubt of roelof1967 is from exercise 1.6…… But aside the echo thing you are absolute correct, what is missing for him is the () on the while conditional.

=)