GMP_INTVAL(3) 1 GMP_INTVAL(3)
gmp_intval - Convert GMP number to integer
SYNOPSIS
int gmp_intval (GMP $gmpnumber)
DESCRIPTION
This function converts GMP number into native PHP integers.
PARAMETERS
o $gmpnumber
-Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is
possible to convert the latter to a number.
RETURN VALUES
The integer value of $gmpnumber.
EXAMPLES
Example #1
gmp_intval(3) example
<?php
// displays correct result
echo gmp_intval("2147483647") . "
";
// displays wrong result, above PHP integer limit
echo gmp_intval("2147483648") . "
";
// displays correct result
echo gmp_strval("2147483648") . "
";
?>
The above example will output:
2147483647
2147483647
2147483648
NOTES
Warning
This function returns a useful result only if the number actually fits the PHP integer (i.e., signed long type). If you want just
to print the GMP number, use gmp_strval(3).
PHP Documentation Group GMP_INTVAL(3)