# `gmp_perfect_power()`

> Section in “New and Extended Functionality › Mathematics” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/mathematics/gmp_perfect_power/>

The `gmp_perfect_power()` function can be used to check whether a number is a [perfect power](https://en.wikipedia.org/wiki/Perfect_power):

``` php
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)

---

Previous: [gmp_lcm()](https://php7explained.com/new-and-extended-functionality/mathematics/gmp_lcm/index.html.md) | Next: [Graphics](https://php7explained.com/new-and-extended-functionality/graphics/index.html.md)
