BitMasks: Emulate Unix Permissions in PHP



Bitmasking is a very useful method to emulate Unix-style file permissions (read/write/execute for example). What's nice about a PHP implementation is that you can configure your own bitmasks and use them for any kind of permissions in your scripts and applications. The implementation is relatively simple as well.

To begin, define your permissions scheme. When setting up your scheme, the easiest method is to use powers of two (the reasoning behind this will become apparent when you see the decoding function). Here's a sample permission scheme:

read more


iPhone Detection



If you develop website for iPhonetm or iPod Touchtm, you might want the user to be redirected to another page.

The version of Safari used by the iPod Touch is the same as the version used by the iPhone, but carries a different user agent string.

read more
copyright ericpotvin.us 2010 © all rights reserved.