Arithmetic with Arbitrarily Large Integers in PHP

后端 未结 4 558
小蘑菇
小蘑菇 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:05

    The PHP GMP extension will be better for this. As an added bonus, you can use it to do your decimal-to-binary conversion, like so:

    gmp_strval(gmp_init($n, 10), 2);
    

提交回复
热议问题