GMP_POW(3) 1 GMP_POW(3)
gmp_pow - Raise number into power
SYNOPSIS
GMP gmp_pow (GMP $base, int $exp)
DESCRIPTION
Raise $base into power $exp.
PARAMETERS
o $base
- The base number. 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.
o $exp
- The positive power to raise the $base.
RETURN VALUES
The new (raised) number, as a GMP number. The case of 0^0 yields 1.
EXAMPLES
Example #1
gmp_pow(3) example
<?php
$pow1 = gmp_pow("2", 31);
echo gmp_strval($pow1) . "
";
$pow2 = gmp_pow("0", 0);
echo gmp_strval($pow2) . "
";
$pow3 = gmp_pow("2", -1); // Negative exp, generates warning
echo gmp_strval($pow3) . "
";
?>
The above example will output:
2147483648
1
PHP Documentation Group GMP_POW(3)