public static function gcd($a, $b)
    {
        $ta = abs($a);
        $tb = abs($b);
        while ($tb != 0) {
            $tmp = $tb;
            $tb = $ta % $tb;
            $ta = $tmp;
        }
        
        return $ta;
    }