PHP - gmp_root() Function
Definition and Usage
The gmp_root() function returns the integer value for the root.
Description
The gmp_root() takes the nth root of the number given and returns the integer value.
Syntax
gmp_root ( GMP $a , int $nth ) : GMP
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
a It can a GMP resource number , a gmp object or a numeric string. |
| 2 |
nth The positive root to be taken for number a. |
Return Values
PHP gmp_root() function returns GMP number as integer from the root taken.
PHP Version
This function will work from PHP Version greater than 5.6.0.
Example 1
Working of gmp_root −
<?php
$num = gmp_root('144', 2);
echo "The result is : ".$num;
?>
This will produce following result −
The result is : 12
Example 2
Working of gmp_root() −
<?php
$num = gmp_root('2685619', 3);
echo "The result is : ".$num;
?>
This will produce following result −
The result is : 139
php_function_reference.htm
Advertisements