PHP Bitwise Tutorial - Bits, Bytes, Binary Math and Use Cases
April 16, 2005
I created a tutorial on PHP's bitwise functions and how they work. Its a helpful tutorial for anyone who is looking to understand any part of bits, bytes, binary math or the PHP bitwise operators and why they can be beneficial.
http://www.litfuel.net/tutorials/bitwise.htm
hope it can help someone out there :)
What this tutorial will cover:
1. What are bits and bytes
2. PHP's Bitwise Operators
3. A simple usecase for why you would want to use bitwise operators
http://www.litfuel.net/tutorials/bitwise.htm
hope it can help someone out there :)
What this tutorial will cover:
1. What are bits and bytes
2. PHP's Bitwise Operators
3. A simple usecase for why you would want to use bitwise operators
k0ng says:
April 24, 2005 @ 17:17 — Reply
Great tutorial. Now I know why ($x & 1) works as an easy check for whether a variable is odd or even.
paulG says:
September 24, 2007 @ 10:51 — Reply
Likewise! Swotting for my zend cert, thanks for shining the spotlight into this forgotten corner for me so ludicrously well. I still haven't figured out how I am gonna use em, but here's some further bits I added to your example to show just how useful the little blighters are ... $level[1] = 'read'; $level[2] = 'write'; $level[4] = 'comment'; $level[8] = 'delete'; $level[16] = 'approve'; $noob = 3; $martin = 28 ; // frig with this till you get all the stuff he can do foreach ($level as $k=>$v) if( $martin & $k) echo 'Martin can ' . $v . ''; God, I'm starting to feel like a programmer... I am going to find another use for these.
Mike says:
December 24, 2009 @ 08:58 — Reply
Comment pending moderation
replica handbags says:
January 29, 2010 @ 22:54 — Reply
Comment pending moderation
blu ray ripper says:
April 18, 2010 @ 06:43 — Reply
Comment pending moderation
Louis Vuitton says:
May 10, 2010 @ 20:57 — Reply
Comment pending moderation
virbram five fingers says:
June 4, 2010 @ 23:40 — Reply
Comment pending moderation
LOUIS VUIttON STOre says:
June 9, 2010 @ 23:24 — Reply
Comment pending moderation
CT0-101 says:
June 12, 2010 @ 17:56 — Reply
Comment pending moderation
louis vuitton replica says:
June 21, 2010 @ 21:09 — Reply
Comment pending moderation
replicas watches says:
June 22, 2010 @ 03:05 — Reply
Comment pending moderation
replicas watches says:
June 22, 2010 @ 03:07 — Reply
Comment pending moderation