PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Reddit.com: How and When do you use Bitwise?

Note: This article was originally published at PHPDeveloper on 7 April 2012.
PHPDeveloper

In this new question to Reddit, there's a question about the usage of bitwise operators - when they might come in useful.

As I get deeper into PHP I notice some lower level functionality that looks like it could be interesting, maybe even useful. I'm trying (other than switching the hex value of a color) to figure out when Bitwise operators might come in handy. Any real world examples?

Responses to the post mention a few cases they'd be useful in - handling permissions, route matching and error reporting. You can find out more about bitwise operators in PHP the PHP manual.