Computer >> Computer tutorials >  >> Programming >> PHP

gmp_pow() function in PHP


The gmp_pow() function computes the power raised to a number of a GMP number and an integer.

Syntax

gmp_pow( base, pow )

Parameters

  • base_num: The base number
  • pow: The power raised to the base.

Return

The gmp_pow() function returns the result as a positive GMP number i.e. $base to the power $pow.

Example

The following is an example:

<?php
   $base_num = "7";
   $pow = 2;
   $res= gmp_pow($base_num, $pow;
?>

Output

The following is the output:

49