Euclidean Algorithm in PHP