note 66452 added to language.operators.bitwise
| From: | riseofthethorax at earthlink dot net | Date: | Tue, 23 May 2006 06:05:03 +0000 |
| Subject: | note 66452 added to language.operators.bitwise | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-111847@lists.php.net to get a copy of this message | ||
Bitwise operators and boolean operations are not the same. Booleans can work on individual bits, but
not on bytes. A byte contains 8 bits. If you do 1 && 0 you will get 0, but if
you do 7 && 0 you will also get 0, because internally
anything that is non-zero is true, and zero is false. So 5 && 2 is 1.. But if you do 5 &
2, noticed one ampersand not two, which in binary is 101, 010, bit-wise and, will get you 111, or 7.
Do a search on the net for "truth tables bit operators XOR AND NOT OR", or shorten it to
"truth tables XOR" and hunt down pages with truth tables for bit operations. For instance
I fount this page:
http://andercheran.aiind.upv.es/~amstrad/docs/logic.html
----
Server IP: 216.194.113.175
Probable Submitter: 68.35.1.172
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.operators.bitwise.php
Edit -- http://master.php.net/note/edit/66452
Del: integrated -- http://master.php.net/note/delete/66452/integrated
Del: useless -- http://master.php.net/note/delete/66452/useless
Del: bad code -- http://master.php.net/note/delete/66452/bad+code
Del: spam -- http://master.php.net/note/delete/66452/spam
Del: non-english -- http://master.php.net/note/delete/66452/non-english
Del: in docs -- http://master.php.net/note/delete/66452/in+docs
Del: other reasons-- http://master.php.net/note/delete/66452
Reject -- http://master.php.net/note/reject/66452
Search -- http://master.php.net/manage/user-notes.php