PHP.nl

gmp_gcd

gmp_gcd

Calculate GCD

GMP **gmp_gcd**  $num1  $num2

Calculate greatest common divisor of and . The result is always positive even if either of, or both, input operands are negative. num1``num2

num1``num2

A positive GMP number that divides into both and . num1``num2

Voorbeeld: example

<?php
$gcd = gmp_gcd("12", "21");
echo gmp_strval($gcd) . "\n";
?>
3

gmp_lcm