gmp_perfect_power()

The gmp_perfect_power() function can be used to check whether a number is a perfect power:

var_dump(gmp_perfect_power(8));
var_dump(gmp_perfect_power(7));

Executing the code shown above will print the output shown below:

bool(true)
bool(false)