如何解析PHP中的long值? [英] How to parse long value in php?

查看:368
本文介绍了如何解析PHP中的long值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要类似intVal()的名称,但需要更大的数字,例如:100001416147426.

Need something like intVal() but for bigger numbers, for example: 100001416147426.

php中是否有类似这样的功能?找不到.

Is there a function like this in php? Can't find it.

推荐答案

您应使用 BC数学,它可以通过PHP设计为任意大小的数字.

You should use BC Math, it is designed to numbers of any size with PHP.

BC Math扩展提供了

  • bcadd添加两个任意精度数字
  • bccomp —比较两个任意精度数字
  • bcsqrt获取任意精度数的平方根
  • ...
    • bcadd Add two arbitrary precision numbers
    • bccomp — Compare two arbitrary precision numbers
    • bcsqrt Get the square root of an arbitrary precision number
    • ...

    在PHP文档站点上,有小代码示例 >查尔斯舍入一个长数字!

    On the PHP documentation site there is a small code example by Charles to round a long number!

    这篇关于如何解析PHP中的long值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆