function _ad_weight_probability_gcd in Advertisement 5.2
Same name and namespace in other branches
- 6.3 weight/probability/ad_weight_probability.inc \_ad_weight_probability_gcd()
- 6.2 weight/probability/ad_weight_probability.inc \_ad_weight_probability_gcd()
- 7 weight/probability/ad_weight_probability.inc \_ad_weight_probability_gcd()
Helper function to calculate the greatest common divisor using the Euclidean algorithm (http://en.wikipedia.org/wiki/Euclidean_algorithm).
1 call to _ad_weight_probability_gcd()
- ad_weight_probability_gcd in weight/
probability/ ad_weight_probability.inc - Returns the greatest common divisor of an array of integers.
File
- weight/
probability/ ad_weight_probability.inc, line 49 - A plug in for the ad.module, allowing an admin to set the probability that a given advertisement will be displayed.
Code
function _ad_weight_probability_gcd($a, $b) {
if ($b == 0) {
return $a;
}
else {
return _ad_weight_probability_gcd($b, $a % $b);
}
}