具有溢出整数的PHP模数

时间:2013-07-24 17:19:48

标签: php math modulus

我从乘法中得到整数溢出值7.233907357909E+16

现在我需要计算模数7.233907357909E+16 % 15

我如何解决它,任何想法如何做到这一点?

1 个答案:

答案 0 :(得分:1)

You should look into bcmul and bcmod for arbitrary precision computations.

Example:

$res = bcmul('134334244395933282', '2834783723423487283');
$modRes = bcmod($res, '15');
echo $modRes;