# Logical Operators (Greater than Equal & Less than Equal) php

by anonymous

• 0
• 0
• 0
77 views
```Orignal Source:http://codingvilla.com/logical-operators-php-single-article-597.aspx
Greater than Equal

Code:

<?
\$var1 = 56;
\$var2 = 56;
echo "two variable  values are \$var1 .... \$var2 check for greater ";
echo "<br/>";
if (\$var2 >= \$var1) {
echo "greater than or equal value from both  is \$var2";
} else {
echo "not greater or equal ";
}
echo "<br/>";
?>

Output:

two variable values are 56 .... 56 check for greater
greater than or equal value from both is 56

Explanation:

In the above example we have assigned two values to two variables \$var1,\$var2 and also printed their actual values. Then we have Check by greater operator or equal to check which value is greater or equal on line 6. If \$var2 is greater than or equal to \$var1 then print \$var2 is greater than or equal to, if not then print not greater or equal.

Less than Equal

Code:

<?
\$var1 = 54;
\$var2 = 56;
echo "two variable  values are \$var1 ... \$var2 check for greater ";
echo "<br/>";
if (\$var1 <=\$var2) {
echo "less than or equal  value is \$var1";
} else {
echo "not less  or Equal";
}
echo "<br/>";
?>

Output:

two variable values are 54 ... 56 check for greater
less than or equal value is 54

Explanation:

In the above example we have assigned two values to two variables \$var1,\$var2.We have also printed their actual values. Then we have checked by less or equal to operator to check which value is less or equal on line 6. If \$var1 is less than or equal to \$var2 then print \$var1 is less than or equal to if not print not less or equal.```