Parse error: syntax error, unexpected T_IF on line 9


#1


whats wrong with this piece of code?
I cant even get the error.:frowning:


<?php
        $items =30     // Set this to a number greater than 5!
        
        if($items > 5) {
          echo "You get a 10% discount!";
        }
      ?>


#2

$items > 5==true // one or other ;)

compare this

$items > 5

Or compare this

$items == true

If you wann compare more than one value you should use && or || you can read more about it
here Comparsion operators


#3

yea that was wrong i just saw it on one of answers and gave it a try...but do you understand the ERROR?


#4

List of Parser Tokens

There you can read what T_IF means. As Example wrong comparsion operators throws that error.


#5

yea got it thank you...its funny if it founds a statement without a semicolon at the end it picks on IF statement:D and im stupid..thank you


#6

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