PHP gmp_perfect_power() Function Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The gmp_perfect_power() function is an inbuilt function in PHP that is used to check the perfect power of the number. Syntax: gmp_perfect_power(GMP|int|string $num): boolParameters: This function accepts only one parameter which is described below. $num: A GMP number resource representing the number you want to check for being a perfect power.Return Value: The gmp_perfect_power() function returns the true of the perfect power existing of the number otherwise this function will return false. Program 1: The following program demonstrates the gmp_perfect_power() function. PHP <?php $num = 4; if (gmp_perfect_square($num)) { echo "This is perfect square number"; } else { echo "This is not perfect square number"; } ?> Output: This is perfect square number Program 2: The following program demonstrates the gmp_perfect_power() function. PHP <?php $num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; $array_length = count($num); for ($i = 0; $i < $array_length; $i++) { $square = $num[$i] * $num[$i]; if (gmp_perfect_power($square)) { echo "This is perfect square number $square.\n"; } } ?> Output: This is perfect square number 1.This is perfect square number 4.This is perfect square number 9.This is perfect square number 16.This is perfect square number 25.This is perfect square number 36.This is perfect square number 49.This is perfect square number 64.This is perfect square number 81.This is perfect square number 100.Reference: https://www.php.net/manual/en/function.gmp-perfect-power.php Comment More infoAdvertise with us Next Article PHP gmp_perfect_power() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-gmp Similar Reads PHP | gmp_perfect_square() Function The gmp_perfect_square() is an inbuilt function in PHP which checks if the given GMP number(GNU Multiple Precision: For large numbers) is a perfect square or not. Syntax: gmp_perfect_square($num) Parameters: The function accepts one GMP number $num. This parameter can be a GMP object in PHP version 2 min read PHP | gmp_pow() Function The gmp_pow() is an inbuilt function in PHP which is used to calculate the power raised to a number of a GMP number and an integer (GNU Multiple Precision: For large numbers). Syntax: gmp_pow( $base, $exp ) Parameters: The function accepts two mandatory parameters $base and $exp. $base - It is the b 2 min read PHP | gmp_powm() Function The gmp_powm() is an inbuilt function in PHP which is used to calculate the number raised to a power of two GMP numbers modulo of another GMP number.(GNU Multiple Precision: For large numbers)Syntax: gmp_pow( $base, $exp, $mod) Parameters: The function accepts three mandatory parameters $base, $exp 2 min read PHP gmp_legendre() Function The gmp_legendre() function is an in-built function in PHP which computes the Legendre symbol of two GMP numbers (GNU Multiple Precision: For large numbers) $num1 and $num2 passed as parameters to the function and returns it. $num2 must be positive and odd. Syntax: gmp_legendre( $num1, $num2 ) Param 2 min read PHP | gmp_neg() Function The gmp_neg() function is an in-built function in PHP which returns the negative of a GMP number (GNU Multiple Precision). Syntax : gmp_neg( $num ) Parameters : The function accepts only one mandatory parameter $num which can be either a GMP number resource in PHP 5.5 or a GMP object in PHP version 1 min read Like