PHP Largest Possible Integer Constant
Was reading the PHP manual on integer overflow in the manual and was wondering: is there a PH开发者_开发技巧P pre-defined constant for the current largest integer value possible? Something equivalent to the JavaScript Number.MAX_VALUE
constant.
From here:
PHP_INT_MAX (integer)
Available since PHP 4.4.0 and PHP 5.0.5
PHP_INT_MAX
according to PHP.net. Please note that the actual max value depends on whether PHP is compiled for 32bit or 64bit.
Also, you can use PHP_INT_SIZE
to get the size of the integer.
The PHP_INT_MAX
contant contains the largest possible integer (in PHP 4.4.0/5.0.5 and newer).
On 32-bit system, this would normally be 2147483647
(2.1 * 109). On a 64-bit system, it would usually be 9223372036854775807
(9.2 * 1018).
精彩评论