bitwise operators only work on integers in PHP and the maximum size of an integer is 2^63 on 64bit servers. If I create a value greater than that it will cast my variable to a float and bitwise operators will stop functioning. I have the following example:
<?php
$CAN_DANCE = 2;
$CAN_SING = 4;
$CAN_PLAY = 8;
$CAN_BEGOD = pow(2,64);
$userperms = $CAN_PLAY | $CAN_DANCE | $CAN_SING | $CAN_BEGOD;
if($userperms & $CAN_DANCE)
echo 'This will work';
if($userperms & $CAN_BEGOD)
echo 'This will not work';
?>
Naturally it will return true for the first check as thats less than 2^63 however for the latter I assign it to 2^64 which is too great for an integer and it incorrectly returns false. Is there any way to make it work for greater than 2^63? Otherwise I will only be able to use bitperms for upto 63 different items only.