note 15476 added to language.expressions
| From: | tmacamNOSP at Mufc dot br | Date: | Thu, 13 Sep 2001 03:57:28 +0000 |
| Subject: | note 15476 added to language.expressions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17965@lists.php.net to get a copy of this message | ||
As reported previously, PHP boolean operators seem to short-circuit. What if you want them to do not
short-circuit?
Exemple:
$result_of = f1() and f2() and f3()
suppose you want to run f3 even when f1 already returned false.
If you perform some silly tests such as:
echo true + true;
you'll see that indeed, true=1 and false=0 and true+true = 2 (ok. this _is_ silly!)
Anyway, the point is: you could use * (multiplication) instead of 'and', to get a not
short-circuiting 'and' and + (sum) to get a not short-circuiting or.
[]s
MaCa
http://www.php.net/manual/cs/language.expressions.php