문제

I use same code in different machine.

Ubuntu 64

$test = 51339780210;         
echo (int) $test; die; //result : 51339780210

Centos 32

$test = 51339780210;         
echo (int) $test; die; //result : -199827342

Why these result is different?

도움이 되었습니까?

해결책

How many bits are both systems? This can be the difference between 32-bit system and 64-bit system.

다른 팁

Execute "uname -a" on both systems. I'd assume the ubuntu says something with x86_64, which means it's 64 bit, while Centos says i686, which is 32 bit.

From PHP manual:

   The size of an integer is platform-dependent ...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top