You can accomplish this using BC Math (Arbitrary Precision Mathematics):
BC Math allows you to perform mathematic operations on numbers. The difference between using arithmetic operators and using BC Maths is that instead of storing the number as an integer or a float, BC Math returns the number as string.
http://php.net/manual/en/ref.bc.php
PHP has to be compiled with BC Math; however most PHP installs should have this.
Unfortunately you can't do bitwise operations on strings, and BC Math doesn't have any built-in bitwise functions. However; after doing a bit of Googling, I found the following code sample and I've copied and pasted it here below:
function bitValue($no) { return bcpow(2, $no); }
function bitSet($no, $value) {
$tmp = bcmod($value, bitValue($no+1));
return bccomp(bcsub($tmp, bitValue($no)), 0)>= 0;
}
echo bitSet(49, bitValue(48)) ."\n";
echo bitSet(48, bitValue(48)) ."\n";
echo bitSet(47, bitValue(48)) ."\n";
(Credits to hernst42)