note 8002 deleted from language.operators.logical by nlopess
| From: | nlopess@php.net | Date: | Fri, 02 Jun 2006 08:57:05 +0000 |
| Subject: | note 8002 deleted from language.operators.logical by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-112916@lists.php.net to get a copy of this message | ||
Note Submitter:
----
The OR operator can be used to roughly imitate the behavior of an IF statement.
For example:
is_array ($variable)
OR die ("$variable is not an array");
This works because PHP uses lazy (aka short-circuit) evaluation for the OR logical operator.
If the expression on the left side of OR evaluates to TRUE, then PHP does not need to evaluate the
expression on the right of OR to determine that at one of the expressions is true.
However, if the left side is false, then PHP must try to find if the right side of the expression is
true or false.