You are here

function spam_range in Spam 6

Same name and namespace in other branches
  1. 5.3 spam.module \spam_range()

Support PHP4 which has no 'step' parameter in its range() function.

3 calls to spam_range()
spam_admin_filters in ./spam.module
spam_admin_settings_form in ./spam.module
Spam module settings form.
spam_filter_node_age_admin_settings in filters/spam_filter_node_age/spam_filter_node_age.module
Module administrative configuration options.

File

./spam.module, line 2131
Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.

Code

function spam_range($low, $high, $step = 1) {
  if (version_compare(phpversion(), '5') < 0) {

    // Emultate range with a step paramater for PHP4 users.
    $rng = array();
    for ($i = $low; $i <= $high; $i += $step) {
      $rng[] = $i;
    }
    return $rng;
  }
  else {
    return range($low, $high, $step);
  }
}