<?php
$sum = gmp_add("123456789012345", "76543210987655");
echo gmp_strval($sum) . "\n";
?> 当然是能用任意长度整数的,GMP Functions
还有BcMath库用与任意精度数学的bcadd()函数当然还是看下手册。
记的不是很清楚,不好意思。

解决方案 »

  1.   

    $sum = bcadd("999123456789012345", "76543210987655");
    echo $sum . "\n";
      

  2.   

    IV. BCMath Arbitrary Precision Mathematics Functions
    介绍
    For arbitrary precision mathematics PHP offers the Binary Calculator which supports numbers of any size and precision, represented as strings. 需求
    Since PHP 4.0.4, libbcmath is bundled with PHP. You don't need any external libraries for this extension.
      

  3.   

    pear.php.net有一个math.integer类。你可以看看。可以有同样的作用。
      

  4.   

    绝决不是溢出,不要想当然!<?php
    $a = 1073741824;
    $b = 2147483648;var_dump(decbin($a)); //string(31) "1000000000000000000000000000000" 
    var_dump(decbin($b)); //string(32) "10000000000000000000000000000000" 
    var_dump(decbin($a | $b)); //string(32) "11000000000000000000000000000000" ?>