euclid's gcd algorithm code example
Example 1: gcd algorithm
function gcd(a, b)
if b = 0
return a
else
return gcd(b, a mod b)
Example 2: euclid algorithm
function mcd($a,$b) {
while($b) list($a,$b)=array($b,$a%$b);
return $a;
}