note 32875 added to language.operators
| From: | php at electricsurfer dot com | Date: | Mon, 09 Jun 2003 20:34:12 +0000 |
| Subject: | note 32875 added to language.operators | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50050@lists.php.net to get a copy of this message | ||
Work-around for absence of ||= and &&=
When working with booleans you can use |= and &= instead and the result will be an integer 0 or
1 which you can cast to bool if necessary.
You can also use |= and &= in place of ||= and &&= if you originally have integers, and
then cast the result to bool if necessary. This works because PHP casts 0 to false and any other #
(including negatives) to true.
----
Manual Page -- http://www.php.net/manual/en/language.operators.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32875
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32875&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32875&report=yes