PHP int值取决于系统


PHP int value is dependent on system

我在不同的机器中使用相同的代码。

Ubuntu 64

$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位。

来自PHP手册:

   The size of an integer is platform-dependent ...