Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 63 - 2617_JSSPS_C-7
P. 63

    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 result. 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:

                                                                                                                PHP     61

| 58 59 60 61 62 63 64 65 66 67 68 |