【问题标题】:Reliable method to find byte size of int, float and double?找到int,float和double的字节大小的可靠方法?
【发布时间】:2014-09-03 06:01:11
【问题描述】:

pack 函数中,整数 iI、浮点数 f 和双精度数 d 的字节大小取决于机器。我怎样才能知道这些尺寸是多少?

【问题讨论】:

  • 找到一种方法:$sizeOfInt = strlen(decbin(~0))/8;

标签: php binary pack


【解决方案1】:

实际上有一个名为PHP_INT_SIZE 的常量。浮点数应与 int 大小相同,双精度数应为两倍。

【讨论】:

    猜你喜欢
    • 2013-09-25
    • 1970-01-01
    • 1970-01-01
    • 2015-04-16
    • 2014-02-16
    • 1970-01-01
    • 1970-01-01
    • 2011-12-31
    • 2014-10-20
    相关资源
    最近更新 更多