Why it tells me that this is not a valid comparison?


#1



<?php
1 < 3 ;
?>



#2

<?php
9 > 5;
?>

even i am getting the same problem...though my code is correct it tells me not a valid comparison...please help


#3

I entered a valid comparison:
4 < 3;
which should result in being false, but otherwise correct.
Please specify the question better, or correct your evaluating code.


#4

Type it as follows:
Use a space after numbers and the operator and also before the semicolon.
For Ex.

<?php
4 < 10 ;
?>

Many a times the editor doesn't accept the code if a space is left before the semicolon.


#5
<?php
   $items = 8 // Set this to a number greater than 5!

   if($items > 5) {;
      echo "You get a 10% discount!";
?>
Oops, try again.
Make sure to edit the condition line 9 so that it is true.

What's wrong?


#6

Saved my life. But it's really stupid error, I never had a single problem if there was no space before ';' before.


#7

<?php
$items = 6; // Set this to a number greater than 5!

    if ($items < 5;) {
      echo "You get a 10% discount!";
    }
  ?>

should work


#8

Hi you should remove the ; inside your if condition.
And here

$item = 6;
if ($items < 5)

Its like that:

if (6 < 5)  which is false and won't run the echo statement

If you it to work you should just change < to >