Forum und email

gmp_gcd

(PHP 4 >= 4.0.4, PHP 5)

gmp_gcd — Calculate GCD

설명

resource gmp_gcd ( resource $a , resource $b )

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 수 resource나 수로 변환할 수 있는 문자열일 수 있습니다.

b

GMP 수 resource나 수로 변환할 수 있는 문자열일 수 있습니다.

반환값

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