Skip to content

Instantly share code, notes, and snippets.

@mikelbring
Created March 23, 2012 20:31
Show Gist options
  • Save mikelbring/2174664 to your computer and use it in GitHub Desktop.
Save mikelbring/2174664 to your computer and use it in GitHub Desktop.
<?php
//Here we're setting BIT_0, BIT_1, ..., BIT_15 for use with octal notation
//It's basically saving 1,2,4,8,16, ..., 32768 to prevent possible typos and less calculations
// 2^n = BIT_n
$t = 1;
for ($i = 0; $i < 16; $i++) {
define('BIT_' . $i, $t);
$t <<= 1;
}
unset($t);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment