©
Ce document utilise Manuel du site Web PHP chinois Libérer
These functions allow you to work with arbitrary-length integers using the GNU MP library.
These functions have been added in PHP 4.0.4.
Note:
Most GMP functions accept GMP number arguments. These are shown in this documentation as GMP objects; however note that PHP 5.5 and earlier represented GMP numbers as resource s. Most of these functions will also accept numeric and string arguments, so long as it is possible to convert the latter to a number. Also, if there is a faster function that can operate on integer arguments, it would be used instead of the slower function when the supplied arguments are integers. This is done transparently, so the bottom line is that you can use integers in every function that expects GMP number. See also the gmp_init() function.
Note:
From PHP 5.6 onwards, you can use arithmetic, bitwise and comparison operators with the GMP objects returned from gmp_init() and other GMP functions.
If you want to explicitly specify a large integer, specify it as a string. If you don't do that, PHP will interpret the integer-literal first, possibly resulting in loss of precision, even before GMP comes into play.
Note: This extension is available on Windows platforms since PHP 5.1.0.