note 74720 added to language.operators.bitwise
| From: | dondothosekatgmaildotcom at osu1 dot php dot net | Date: | Wed, 25 Apr 2007 01:05:07 +0000 |
| Subject: | note 74720 added to language.operators.bitwise | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125846@lists.php.net to get a copy of this message | ||
Don't forget operator precedence. == has a higher precedence than does & so in the cases
that you've written
if (9 & 8 == 8) echo 'true'; else echo 'false';
is the same as 9 & (8 ==8) which is 9 & true or 9 & 1 which is 1 which is true
if (8 & 8 == 8) echo 'true'; else echo 'false';
is the same as 8 & (8 == 8) which is 8 & true or 8 & 1 which is 0 which is false
Putting in parentheses is required to cause the bitwise and to take place before the comparison.
----
Server IP: 69.39.81.135
Probable Submitter: 65.91.98.102
----
Manual Page -- http://www.php.net/manual/en/language.operators.bitwise.php
Edit -- https://master.php.net/note/edit/74720
Del: integrated -- https://master.php.net/note/delete/74720/integrated
Del: useless -- https://master.php.net/note/delete/74720/useless
Del: bad code -- https://master.php.net/note/delete/74720/bad+code
Del: spam -- https://master.php.net/note/delete/74720/spam
Del: non-english -- https://master.php.net/note/delete/74720/non-english
Del: in docs -- https://master.php.net/note/delete/74720/in+docs
Del: other reasons-- https://master.php.net/note/delete/74720
Reject -- https://master.php.net/note/reject/74720
Search -- https://master.php.net/manage/user-notes.php