Arithmetic with Arbitrarily Large Integers in PHP

后端 未结 4 551
小蘑菇
小蘑菇 2020-12-07 01:50

Ok, so PHP isn\'t the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I\'m trying to

4条回答
  •  死守一世寂寞
    2020-12-07 02:00

    As far as I can tell, the bcmath extension is the one you'll want. The data in the PHP manual is a little sparse, but you out to be able to set the precision to be exactly what you need by using the bcscale() function, or the optional third parameter in most of the other bcmath functions. Not too sure on the binary strings thing, but a bit of googling tells me you ought to be able to do with by making use of the pack() function.

提交回复
热议问题