Home >Backend Development >PHP Tutorial >PHP4.04 adds support for infinite precision operations_PHP Tutorial
These functions allow you to work with arbitrary-length integers using the GNU MP library. In order to have these functions available, you must compile PHP with GMP support by using the --with-gmp option. MP library, these functions allow you to work with integers of arbitrary length. You need to use the --with-gmp parameter when compiling php
You can download the GMP library from http://www.swox.com/gmp/. Download the GMP library, which also comes with a manual. You will need GMP version 2 or better to use these functions. Some functions may require the latest GMP libraries
Note: Most GMP functions accept GMP numeric parameters defined in the resource below. Of course, most functions also accept numeric and string parameters, but they will be converted to numbers. At the same time, if a faster function exists to operate on integer parameters, that faster function will be used to operate on integers. This is of course so you can use integer arguments wherever GMP numbers are required.
if ($x <= 1)
return 1;
else
return gmp_mul ($x, fact ( $x-1));
}
?>