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

gmp_root() function in PHP


The gmp_root() function gets the integer part of the nth root of a GMP number.

Syntax

gmp_pow(X, nth)

Parameters

  • X: The GMP number whose integer part of the nth root is returned.
  • nth: Positive nth root of the number.

Return

The gmp_root() function returns the integer part of the nth root of the X.

Example

The following is an example:

<?php
   $x = "9";
   $n = 3;
   $res = gmp_root($x, $n);
   echo $res;
?>

Output

The following is the output:

2