• PHP Video Tutorials

PHP - gmp_rootrem() Function



Definition and Usage

The gmp_rootrem() function returns the integer value and remainder from the nth root.

Description

The gmp_rootrem() takes the nth root of the number given and returns the integer value and remainder.

Syntax

gmp_rootrem ( GMP $a , int $nth ) : array
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_rootrem() function returns an array with first element the integer value and second one is the remainder.

PHP Version

This function will work from PHP Version greater than 5.6.0.

Example 1

Working of gmp_root −

<?php
   $num = gmp_rootrem('150', 2);
   echo "The integer value is : ".$num[0]." and remainder is : ".$num[1];
?>

This will produce following result −

The integer value is : 12 and remainder is : 6

Example 2

Working of gmp_root() −

<?php
	c$num = gmp_rootrem('2685', 3);
	echo "The integer value is : ".$num[0]." and cremainder is : ".$num[1];
?>

This will produce following result −

The integer value is : 13 and remainder is : 488
php_function_reference.htm
Advertisements