PHP code


#1

<?php
$items = 8;

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

This is my code for if else statements. It is showing wrong even if it's correct one. Help me out!


#2

Hello Affreen,

Can you tell me on wich of the exercises you're stuck?
I assume that you're stuck on the last exercise.
Here you have to create and if statement that prints "The condition is true" when the condition is true and "The condition is false" when the condition is false. Also you have to make sure that the condition is false.


#3
<?php
$items = 8;

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

Should be,

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

#6

I confirmed it was the system that was wrong not me ^_^