(PHP 4 >= 4.0.4, PHP 5, PHP 7)
gmp_gcd — Calculate GCD
Calculate greatest common divisor of a
and
b
. The result is always positive even if
either of, or both, input operands are negative.
a
锟斤拷锟斤拷锟斤拷一锟斤拷 GMP 锟斤拷锟斤拷 resouce锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷转锟斤拷为锟斤拷值锟斤拷锟街凤拷锟斤拷锟斤拷
b
锟斤拷锟斤拷锟斤拷一锟斤拷 GMP 锟斤拷锟斤拷 resouce锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷转锟斤拷为锟斤拷值锟斤拷锟街凤拷锟斤拷锟斤拷
A positive GMP number that divides into both
a
and b
.
Example #1 gmp_gcd() example
<?php
$gcd = gmp_gcd("12", "21");
echo gmp_strval($gcd) . "\n";
?>
锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�
3