Page 170 - 2633 Trackpad Pro V5.1 Class 7
P. 170

echo "a is greater than b: ", var_dump($a>$b);

                    echo "<br>a is less than b: ", var_dump($a==$b);
                    echo "<br>a is equal to b: ", var_dump($a>=$b);
                    ?>
                    </BODY>

                    </HTML>
                     Note that var_dump() function is used to evaluate the relational operators. We get the following
                     output when executing the preceding script:














                      Logical operators: They are used to combine multiple conditions and evaluate them. They
                     return a Boolean value 'True' or 'False' as output. Logical operators of PHP are AND(&&), OR (||),
                     XOR(^), NOT(!). Let us create a PHP script to use some of the logical operators.


                    <HTML>
                    <HEAD> <TITLE> Using Variables </TITLE> </HEAD>

                    <BODY>
                    <?php

                    $a = true;
                    $b = false;

                    echo var_dump($a and $b);
                    echo "<br>",var_dump($a or $b);
                    echo "<br>",var_dump($a xor $b);

                    ?>

                    </BODY>
                    </HTML>
                    Note that var_dump() function is used to evaluate the logical operators. We get the following
                     output when executing the preceding script:
















                  168   Premium Edition-VII
   165   166   167   168   169   170   171   172   173   174