gcd.php
Table of Contents
Functions
- gcd() : int
- Calculate the Greatest Common Divisor (GCD) of two integers using the Euclidean algorithm.
Functions
gcd()
Calculate the Greatest Common Divisor (GCD) of two integers using the Euclidean algorithm.
gcd(int $a, int $b[, bool $throwable = false ]) : int
This function returns the absolute value of the GCD. If both numbers
are zero, it either returns 0 or throws an exception depending on
the $throwable
parameter.
Parameters
- $a : int
-
The first integer.
- $b : int
-
The second integer.
- $throwable : bool = false
-
If true, throws an exception when both numbers are zero.
Tags
Return values
int —The greatest common divisor of $a and $b.