Ignoring the special libraries that allow you to work with very big numbers, what's the largest int value you can store in PHP?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Do the Java Integer and Double objects have unnece
- Can php detect if javascript is on or not?
The size of PHP ints is platform dependent:
PHP 6 adds "longs" (64 bit ints).
(a little bit late, but could be useful)
Only trust PHP_INT_MAX and PHP_INT_SIZE, this value vary on your arch (32/64 bits) and your OS...
Any other "guess" or "hint" can be false.
32-bit builds of PHP:
64-bit builds of PHP:
Numbers are inclusive.
Note: some 64-bit builds once used 32-bit integers, particularly older Windows builds of PHP
Values outside of these ranges are represented by floating point values, as are non-integer values within these ranges. The interpreter will automatically determine when this switch to floating point needs to happen based on whether the result value of a calculation can't be represented as an integer.
PHP has no support for "unsigned" integers as such, limiting the maximum value of all integers to the range of a "signed" integer.
Ah I found it: 232 - 1 (2147483647)
http://au2.php.net/int
From the PHP manual:
It depends on your OS, but 2147483647 is the usual value, according to the manual.