Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

gmp_root

Description

The gmp_root of GMP for PHP takes the integer part of nth root.

Syntax

gmp_root(
    GMP|int|string $num,
    int $nth
): GMP

Parameters

num

A GMP object, an int or a numeric string.

nth

The positive root to take of num.

Return

Returns the integer component of the resultant root, as a GMP number.

Examples

1 · num · GMP · nth

<?

$num = 28;
$nth = 3;

$num = gmp_init($num);

$return = gmp_root($num, $nth);

var_dump($return);

?>
object(GMP)#2 (1) {
  ["num"]=>
  string(1) "3"
}

2 · num · int · nth

<?

$num = 28;
$nth = 3;

$return = gmp_root($num, $nth);

var_dump($return);

?>
object(GMP)#1 (1) {
  ["num"]=>
  string(1) "3"
}

3 · num · string · nth

<?

$num = "28";
$nth = 3;

$return = gmp_root($num, $nth);

var_dump($return);

?>
object(GMP)#1 (1) {
  ["num"]=>
  string(1) "3"
}
HomeMenu