You are here

function ad_weight_percent_gcd in Advertisement 5.2

Same name and namespace in other branches
  1. 5 weight/percent/ad_weight_percent.module \ad_weight_percent_gcd()
  2. 6.3 weight/percent/ad_weight_percent.module \ad_weight_percent_gcd()
  3. 6 weight/percent/ad_weight_percent.module \ad_weight_percent_gcd()
  4. 6.2 weight/percent/ad_weight_percent.module \ad_weight_percent_gcd()
  5. 7 weight/percent/ad_weight_percent.module \ad_weight_percent_gcd()

Returns the greatest common divisor of an array of integers.

File

weight/percent/ad_weight_percent.module, line 135
A plug in for the ad.module, providing a percentage based weighting mechanism for the random selection of ads.

Code

function ad_weight_percent_gcd($integers) {
  $gcd = array_shift($integers);
  while (!empty($integers)) {
    $gcd = _ad_weight_percent_gcd($gcd, array_shift($integers));
  }
  return $gcd;
}