You are here

function _ad_weight_percent_gcd in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 weight/percent/ad_weight_percent.module \_ad_weight_percent_gcd()
  2. 5 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()

Helper function to calculate the greatest common divisor using the Euclidean algorithm (http://en.wikipedia.org/wiki/Euclidean_algorithm).

1 call to _ad_weight_percent_gcd()
ad_weight_percent_gcd in weight/percent/ad_weight_percent.module
Returns the greatest common divisor of an array of integers.

File

weight/percent/ad_weight_percent.module, line 167
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($a, $b) {
  if ($b == 0) {
    return $a;
  }
  else {
    return _ad_weight_percent_gcd($b, $a % $b);
  }
}