# `gmp_lcm()`

> 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_lcm/>

The `gmp_lcm()` function can be used to calculate the [least common multiple](https://en.wikipedia.org/wiki/Least_common_multiple):

``` php
var_dump(gmp_lcm(4, 6));
```

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

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

---

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