Oops, try again. Did you set $items to a number greater than 5?


#1

I can't figure out the stupid solution to this problem. Can someone help me???





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

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



#2

Hi jordanwolfe101

While you set it greater then 5 you have it set up

"if($items < 5) {"

Which means you have to set it less then 5, or switch the sign to greater than so that your code can work.


#4

Thank you for giving me that tip taylor99higgins, but the code still won't work.
This is what the entire code looks like:





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

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



So what am I doing wrong?


#5

Your sign after the first $items is < instead of >


#6

Both my signs are set to greater than, but the code still won't work.





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

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



#7

I cant figure that one out myself


#8

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

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

#9

I'm stuck too. This course is giving me the fits.


#10

The correct answer is:

<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>

#11

This was my code and it worked for me! just switched the less than < to greater than >

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

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

#12

you may try add else condition ,then you can pass


#13

if($items > 5) {

you have to switch the < with a > and it will work, as ninkster said

took me a while to notice it. not sure if it was intented.

:smile:


#14

I was stacked too.
But it works if you repeat the instrution echo"bla bla bla"


#15

hi, am having a problem when coding this,it deoes not work





<?php
$items = 3;

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



#16

the problem is that 3 isn't bigger than 5. You set $items = 3. 3>5 is not true, now if it was 3<5 this would be correct. Because 3 is indeed smaller than 5 not bigger as I said before.