Use the boolean compare operators : Logical Operators « Operator « PHP






Use the boolean compare operators


<?
$three = 3;
$four = 4;
$my_pi = 3.14159;       
if (($three == $three) and
    ($four === $four) and
    ($three != $four) and
    ($three < $four) and
    ($three <= $four) and
    ($four >= $three) and
    ($three <= $three) and
    ($my_pi > $three) and
    ($my_pi <= $four))
 print("Yes!<BR>");
else
 print("No?<BR>");
?>
           
       








Related examples in the same category

1.Logical Operators in Order of Precedence
2.Greater than
3.Less than
4.Greate and equal
5.Less than and equal
6.Not equal: !=
7.Logical Operators
8.Logic Operators in PHP
9.Or operator
10.Leap Year Determination
11.Negation operator
12.The not-equals operator
13.Relational Operators summary table
14.Relational Operators in action