range(3) php man page | unix.com

Man Page: range

Operating Environment: php

Section: 3

RANGE(3)								 1								  RANGE(3)

range - Create an array containing a range of elements

SYNOPSIS
array range (mixed $start, mixed $end, [number $step = 1])
DESCRIPTION
Create an array containing a range of elements.
PARAMETERS
o $start - First value of the sequence. o $end - The sequence is ended upon reaching the $end value. o $step - If a $step value is given, it will be used as the increment between elements in the sequence. $step should be given as a posi- tive number. If not specified, $step will default to 1.
RETURN VALUES
Returns an array of elements from $start to $end, inclusive.
EXAMPLES
Example #1 range(3) examples <?php // array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) foreach (range(0, 12) as $number) { echo $number; } // The step parameter // array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100) foreach (range(0, 100, 10) as $number) { echo $number; } // Usage of character sequences // array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'); foreach (range('a', 'i') as $letter) { echo $letter; } // array('c', 'b', 'a'); foreach (range('c', 'a') as $letter) { echo $letter; } ?>
NOTES
Note Character sequence values are limited to a length of one. If a length greater than one is entered, only the first character is used.
SEE ALSO
shuffle(3), array_fill(3), foreach. PHP Documentation Group RANGE(3)
Related Man Pages
array(3) - php
substr_replace(3) - php
array_fill(3) - php
array_slice(3) - php
array_pad(3) - php
Similar Topics in the Unix Linux Community
Create range from a list
Deleting sequences based on character frequency
Using foreach with two lists
Make all words begin with capital letter?
Run the Script from any stage by updating data from Oracle Table.