#### Archived

This topic is now archived and is closed to further replies.

# Studying for my PHP Cert.

## Recommended Posts

I ran across a question about using basic operators...but it seemed to use a "<<" operator and it is no where to be found on Google nor any books I have laying around?

Anyhelp!?

Thanks

##### Share on other sites
[a href=\"http://us2.php.net/manual/en/language.operators.bitwise.php\" target=\"_blank\"]http://us2.php.net/manual/en/language.operators.bitwise.php[/a]

##### Share on other sites
Life saver, thanks.

##### Share on other sites
Hmm, I can't really get a grasp on it...

Help would be appreciated...THANKS!

##### Share on other sites
bitwise operators are used in doing binary math. Just like doing normal base 10 math that you are used to, except for in base 2.

let's say you have this:

\$a = 16;
echo \$a << 2;

\$a would echo 64. why? well lets look at those numbers in base 2:

00010000 // this is 16 in base 10
01000000 // this is 64 in base 10

\$a << 2 shifts the bit over 2 'spaces'. all 8 of those 'spaces' is called a byte. each space is called a bit. now you might better understand this in terms of kilobytes, megabytes, gigabytes, etc.. well this is the base level of that.

here is a really good tutoral on binary mathematics:

[a href=\"http://www.litfuel.net/tutorials/bitwise.htm\" target=\"_blank\"]http://www.litfuel.net/tutorials/bitwise.htm[/a]