If/Else hangs


#1

The training seems to have a bug. Every time I submit a code, the gear icon starts spinning without any feedback. I've been waiting for 10 minutes and more now.
Also, the terminal displays the following error message: "Parse error: syntax error, unexpected $end on line 19" What's even more confusing, because there's no line 19 in my code:

<html>
  <head>
  </head>
  <body>
    <p>
      <?php
        $items = 3;
        
        if($items > 5) {
          echo "You get a 10% discount!";
        }
        else {
          echo "You get a 5% discount!";
        }
      ?>
    </p>
  </body>
</html>


Any idea?


#2


#3

try this

  • cut the whole code
  • refresh your browser
  • paste your code
  • run it

#4

Did that already. In fact, the first time I encountered this issue was yesterday, in a different browser. I thought it could be temporarily, but it wasn't.

I was able to complete the whole Java training as well as some parts of PHP already. But right now I'm stuck because of a bug.

update: Well, tried it once again.. I passed this step now.


#5

glad to hear that :slight_smile:


#6

Thanks for your help!


#7

You need to use brackets { } for else statements, sadly php tutorial is veryyy buggy.


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.