PHP - Write program to create two variables

Requirements

Write a script that creates two variables and assigns a different integer value to each variable.

Now make your script test whether the first value is

  • equal to the second value
  • greater than the second value
  • less than or equal to the second value
  • not equal to the second value

and output the result of each test to the user.

Demo

<?php
         $x = 3;/*www . j  a v  a 2 s.c  o m*/
         $y = 4;
         echo "Test 1 result: " . ($x == $y) . " \n ";
         echo "Test 2 result: " . ($x  >  $y) . " \n ";
         echo "Test 3 result: " . ($x  <= $y) . " \n ";
         echo "Test 4 result: " . ($x != $y) . " \n ";
?>

Result

Related Exercise