function gcd_recursive($a, $b) { if ($b == 0) { return $a; } else { return gcd_recursive($b, $a % $b); } }
public function test_gcd_recursive() { $this->assertEquals(15, gcd_recursive(210, 45)); $this->assertEquals(0, gcd_recursive(0, 0)); $this->assertEquals(1, gcd_recursive(20, 97)); }