You are here

function uc_range in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_store/uc_store.module \uc_range()

Return an array of values like PHP 5's range function.

7 calls to uc_range()
uc_cart_cart_settings_form in uc_cart/uc_cart.module
uc_catalog_admin_form in uc_catalog/uc_catalog.module
Catalog settings form.
uc_product_settings_form in uc_product/uc_product.module
Form to change product settings.
uc_recurring_admin_edit_form in payment/uc_recurring/uc_recurring.module
uc_recurring_feature_form in payment/uc_recurring/uc_recurring.module

... See full list

File

uc_store/uc_store.module, line 2577
Contains global Ubercart functions and store administration functionality.

Code

function uc_range($low, $high, $step = 1) {
  if (!is_numeric($low) || !is_numeric($high)) {
    return array(
      0,
    );
  }
  if ($low == $high || !is_numeric($step) || $step == 0) {
    return array(
      $low,
    );
  }
  if ($step < 0) {
    $step = abs($step);
  }
  $arr = array();
  for ($i = $low; $low < $high ? $i <= $high : $i >= $high; $low < $high ? $i += $step : ($i -= $step)) {
    $arr[] = $i;
  }
  return $arr;
}