<?php
function euclidean$q$r) {

    if (
$q $r) {
        
$t $q;
        
$q $r;
        
$r $t;
    }
    while (
$r != 0) {
        
$t $q $r;
        
$q $r;
        
$r $t;
    }
    return 
$q;
}
?>