Relation Operator
- <?php
- $a = 21; // '$' use for variables
- $b = 10;
- //equal to
- if ($a == $b) // (a=21 == b=10) is False; Therefore a is not equal to b.
- //the two given values are equal to each other then result will be True, Otherwise it returns False.
- {
- echo "a is equal to b"."<br>";
- }
- else
- {
- echo "a is not equal to b"."<br>"; //"echo" use for print line.
- }
- //grater than
- if ($a > $b) //(a=21 > b=10) is True; Therefore a is grater than b.
- //the first value is grater than the second value then result will be True, Otherwise it returns False.
- {
- echo "a is greater than b"."<br>";
- }
- else
- {
- echo "a is not greater than b"."<br>"; //"<br>" use for linebreak.
- }
- //less than
- if ($a < $b) //(a=21 < b=10) is False; Therefore a is not less than b.
- //the first value is less than the second value then result will be True, Otherwise it returns False.
- {
- echo "a is less than b"."<br>";
- }
- else // when If condition flase then; else condition executed.
- {
- echo "a is not less than b"."<br>";
- }
- //grater than or equal to
- if ($a >= $b) //(a=21 >= b=10) is True; Therefore a is grater than or equal to b.
- //the first value is grater than or equal to the second value then result will be True, Otherwise it returns False.
- {
- echo "a is greater than or equal to b"."<br>";
- }
- else
- {
- echo "a is not greater than equal to b"."<br>";
- }
- //less than equal to
- if ($a <= $b) //(a=21 <= b=10) is False; Therefore a is not less than or equal to b.
- //the first value is less than or equal to the second value then result will be True, Otherwise it returns False.
- {
- echo "a is less than or equal to b"."<br>";
- }
- else
- {
- echo "a is not less than or equal to b"."<br>";
- }
- ?>
👉Execute👈
//Output
/*
//equal to
a is not equal to b
//grater than
a is greater than b
//less than
a is not less than b
//greater than or equal to
a is greater than or equal to b
//less than or equal to
a is not less than or equal to b
*/
//ThE ProFessoR