Php – How to have a 64-bit integer in PHP


How can I have a 64-bit integer in PHP?

It seems like it is not by a config file, but rather it might be a compile-time option, and it depends on the platform.

Best Solution

Native 64-bit integers require 64-bit hardware AND the 64-bit version of PHP.

On 32-bit hardware:

$ php -r 'echo PHP_INT_MAX;'

On 64-bit hardware:

$ php -r 'echo PHP_INT_MAX;'