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

gmp_sqrt() function in PHP


The gmp_sqrt() function is used to compute the square root of a GMP number.

Syntax

gmp_sqrt (val)

Parameters

  • val: The GMP number for which we calculate the square root.

Return

The gmp_sqrt() function returns the square root of a GMP number. The result itself is a GMP number.

Example

The following is an example:

<?php
   $val = "49";
   $res = gmp_sqrt(val);
   echo $res;
?>

Output

The following is the output:

7