You are here

function uc_range in Ubercart 6.2

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

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

5 calls to uc_range()
uc_cart_cart_settings_form in uc_cart/uc_cart.admin.inc
General settings for the shopping cart.
uc_catalog_grid_settings_form in uc_catalog/uc_catalog.admin.inc
Settings forms for using a product grid instead of a table in the catalog.
uc_catalog_settings_form in uc_catalog/uc_catalog.admin.inc
Catalog settings form.
uc_shipping_new_package in shipping/uc_shipping/uc_shipping.admin.inc
Puts ordered products into a package.
uc_shipping_package_edit in shipping/uc_shipping/uc_shipping.admin.inc
Rearranges the products in or out of a package.

File

uc_store/uc_store.module, line 1699
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;
}