php5 converts 64 bit integer to double - how force 64-bit?

不羁的心 提交于 2019-12-10 17:48:00

问题


in php5, pass a 64bit integer, 1707541557936130 through GET, but it shows value of 1.7075415579361E+15

how can I force php to use large integers as integers, not as float

when I shift << apparently the result of that is int32 as well, not int64

is there a way to globally say use int64?


回答1:


PHP supports 64bit integers only on 64bit systems. In both cases integers, that are larger than PHP_INT_MAX, are converted to floats. see manual.

Try this code:

<?php
$i=1707541557936130;
var_dump($i);    
echo PHP_INT_MAX;


来源:https://stackoverflow.com/questions/8701655/php5-converts-64-bit-integer-to-double-how-force-64-bit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!