You are here

function ad_weight_probability_gcd in Advertisement 5.2

Same name and namespace in other branches
  1. 6.3 weight/probability/ad_weight_probability.inc \ad_weight_probability_gcd()
  2. 6.2 weight/probability/ad_weight_probability.inc \ad_weight_probability_gcd()
  3. 7 weight/probability/ad_weight_probability.inc \ad_weight_probability_gcd()

Returns the greatest common divisor of an array of integers.

1 call to ad_weight_probability_gcd()
ad_weight_probability_cache_filter in weight/probability/ad_weight_probability.inc
@file A plug in for the ad.module, allowing an admin to set the probability that a given advertisement will be displayed.

File

weight/probability/ad_weight_probability.inc, line 36
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($integers) {
  $gcd = array_shift($integers);
  while (!empty($integers)) {
    $gcd = _ad_weight_probability_gcd($gcd, array_shift($integers));
  }
  return $gcd;
}