[nycphp-talk] Bitwise Operators
Dan Cech
dcech at phpwerx.net
Tue Jun 28 16:37:30 EDT 2005
Joseph Crawford wrote:
> Can anyone here point me in a good direction for a tutorial or something
> about these? I dont understand bits at all.
Bitwise operators are easy, and if you use *nix you use them all the
time in the form of file permissions.
Basically any integer can be represented in binary form:
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
etc.
Bitwise operators simply operate on the binary representation of a
number, one bit at a time, eg:
1 & 3 = 1
0001
& 0011
= 0001
3 | 6 = 7
0011
| 0110
= 0111
Dan
More information about the talk
mailing list