1.20.x utility.inc views_array_key_plus($array)

Adds one to each key of the array.

For example array(0 => 'foo') would be array(1 => 'foo').

File

modules/views/includes/utility.inc, line 293
Utility functions for assembling Views queries.

Code

function views_array_key_plus($array) {
  $keys = array_keys($array);
  rsort($keys);
  foreach ($keys as $key) {
    $array[$key + 1] = $array[$key];
    unset($array[$key]);
  }
  asort($array);
  return $array;
}