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

gmp_powm() function in PHP


The gmp_powm() function

Syntax

gmp_pow( $base, $pow, $mod)

Parameters

  • base: The base number

  • pow: The power raised to the base

  • mod: The result of base and exp is divided with mod to get the remainder

Return

The gmp_powm() function returns a GMP number equivalent to mod of the result generated by basepow

Example

The following is an example:

<?php  
   $base = "3"; $pow = "2"; $mod = "5";
   $powm = gmp_powm($base, $pow, $mod);
?>

Output

The following is the output:

4