最大整数大小

时间:2014-02-09 14:07:39

标签: php binary integer size logical-operators

我可以写变量一个大整数(大于2 ^ 32),然后打印出来

$bigInteger = 712940127394567;
echo $bigInteger;

但是在格式化视图中(布尔值)我只得到零

printf("%b", $bigInteger);  // 0

此外,在逻辑运算中,太大的整数意味着零

$int = 1;
// getting 2^128, using cycle, because 2<<128 works just with <32
for($i=0; $i<128; $i++){
    $int *= 2;
}
$int -= 1;  // 111111.... x127
if (($int & (1 << 8)) == (1 << 8)) {
    echo 'Found that bit';  // 
}

是否可以使用具有超大整数的二元运算符?

0 个答案:

没有答案
相关问题