0

I keep getting an error in my code. the error is:

Parse error: syntax error, unexpected 'do' (T_DO)

I don't know why, it does this for the while tOo, it's the same error:

Parse error: syntax error, unexpected 'while' (T_while)

Here is my code:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Home | Learning PHP</title>
  </head>
  <body>
    <?php
      $x = 2
      do {
        echo "hi there<br>";
        $x++;
      }
    ?>
  </body>
</html>

What am I doing wrong?

FirstOne
  • 6,033
  • 7
  • 26
  • 45

0 Answers0