note 14302 added to control-structures.php
| From: | x at x dot chek dot com | Date: | Wed, 25 Jul 2001 18:42:40 +0000 |
| Subject: | note 14302 added to control-structures.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15844@lists.php.net to get a copy of this message | ||
You should document an alternative à-la Perl form of conditional execution, using the special
"or" and "and" construct:
Here is the equivalence for the "or" special syntax construct:
expression1 or statement;
if (!(expression1)) statement;
Here is the equivalence for the "and" special syntax construct:
expression1 and statement;
if (expression1) statement;
These constructs can be combined in complex logic expressions, with "and" having a higher
priority that "or":
expr1 and expr2 or
expr3 and expr4 or
statement
is equivalent to:
if (!( (expr1) && (expr2) ||
(expr3) && (expr4) ))
statement;
http://www.php.net/manual/en/control-structures.php