What is gmp_pow() in PHP?

gmp_pow() is a function in PHP that calculates the value of the number raised to the power of another number.

Syntax


gmp_pow(GMP|int|string $num, int $exp): GMP

Parameters

  • num: It is the base number. num can be a numeric string, GMP object, or of the integer type.

  • exp: It is the exponent. exp can only be of the integer type.

Return value

gmp_pow() function returns the value of num raised to the exp. The value returned is of type GMP.

Code

<?php
$base = gmp_pow('100', 2);
echo "The result of the gmp_pow function is: ".$base;
?>

Output


The result of the gmp_pow function is: 10000

Free Resources