PHP int值取决于系统
我在不同的机器上使用相同的代码 Ubuntu 64PHP int值取决于系统,php,int,bigint,Php,Int,Bigint,我在不同的机器上使用相同的代码 Ubuntu 64 $test = 51339780210; echo (int) $test; die; //result : 51339780210 Centos 32 $test = 51339780210; echo (int) $test; die; //result : -199827342 为什么这些结果不同?两个系统都有多少位?这可能是32位系统和64位系统之间的差异。在两个系统上执行uname-a。我假设u
$test = 51339780210;
echo (int) $test; die; //result : 51339780210
Centos 32
$test = 51339780210;
echo (int) $test; die; //result : -199827342
为什么这些结果不同?两个系统都有多少位?这可能是32位系统和64位系统之间的差异。在两个系统上执行uname-a。我假设ubuntu使用x86_64表示64位,而Centos使用i686表示32位。来源:
第二个系统是32位的吗?这取决于系统是32位还是64位。
The size of an integer is platform-dependent ...