note 36863 added to language.operators.bitwise
| From: | Eisnel at rn2 dot php dot net | Date: | Fri, 24 Oct 2003 23:25:50 +0000 |
| Subject: | note 36863 added to language.operators.bitwise | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59265@lists.php.net to get a copy of this message | ||
> I'm sorry but this example i just couldnt get i know
> this isnt the place to explain it but i read it here :)
Well, first of all:
49 XOR 57 = 8
It might be clearer in binary:
00110001 XOR 00111001 = 00001000
The result (8) contains only bits that are set in one but not both of the numbers.
Now, when they say "12" ^ "9", here's what they mean: That's an ASCII
"9", its ASCII code is 57. So saying "9" is the same as saying 57. As for the
"12", it will only use the first character, which is the "1", and the ASCII code
for "1" is 49. Therefore:
"12" ^ "9" == "1" ^ "9" == 49 ^ 57 == 8
----
Manual Page -- http://www.php.net/manual/en/language.operators.bitwise.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36863
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36863&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36863&report=yes
Search -- http://master.php.net/manage/user-notes.php