Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要计算大量的模数,例如:
<?php $largenum = 95635000009453274121700; echo $largenum % 97; ?>
它不起作用......因为 $largenum 对于 PHP 中的 int 来说太大了。
知道怎么做吗?
使用bcmod()BCMath任意精度数学:
bcmod()
$largenum = '95635000009453274121700'; echo bcmod($largenum, '97');
请注意,这$largenum是作为字符串传递的,而不是转换为 int 的。
$largenum