Javatpoint Logo
Javatpoint Logo

PHP gmp_root() function

PHP language has developed a function called gmp_root() that delivers the integer value of the N-th root of a given parameter or number.

Syntax

The syntax shows the GMP function to get a root value of the base parameter.

Parameters

  • The function takes two variables: a $base value and $n value. Both variables are essential for the gmp_root() function and its operation.
  • In PHP versions 5.6 and later, the parameter is a GMP object. We can also pass a numeric string as a GMP parameter. The string values convert data into a numeric value.
    • $base_value: it is the GMP number whose integer part is returned as the n-th root.
    • $n_value: it is the number's nth positive root. It is an integer value.

Return Value

This function gives us the integer value of the Nth root of $num as a positive GMP number.

Examples

Example1: The given example shows an "integer part of the last root value" of the given input values.

Output:

The output image shows the integer part of the root value of the given data.

PHP gmp_root() function

Example2: the given example shows an "integer part of the last root value" of the given input values. Here, we can use a negative base value, but it does not work on the n-th value.

Output:

The output image shows the integer part of the root value of the given data.

PHP gmp_root() function

Example3: The given example shows an "integer part of the last root value" of the given variable values.

Output:

The output image shows the integer part of the root value of the given data.

PHP gmp_root() function

Example4: The given example shows an "integer part of the last root value" of the given GMP parameters.

Output:

The output image shows the integer part of the root value of the given data.

PHP gmp_root() function

Example5: the given example shows an "integer part of the last root value" of the given binary values.

Output:

The output image shows the integer part of the root value of the given data.

PHP gmp_root() function

Conclusion

The gmp_root() function removes lengthy coding part of the php languages and creates easy operation for the developer. It returns integer data and part of the n-th value of the given parameter.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA