RANGE
Create an array containing a range of elements
SYNTAX
range ( mixed $start , mixed $end [, number $step = 1 ] ) : array
PARAMETERS
start
First value of the sequence.
end
The sequence is ended upon reaching the end value.
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 positive number. If not specified, step will default to 1.
RETURN
Returns an array of elements from start to end, inclusive.
EXAMPLES
START END | NUMERIC | ASCEND
Array
(
[0] => 0
[1] => 1
[2] => 2
[3] => 3
[4] => 4
[5] => 5
[6] => 6
[7] => 7
[8] => 8
[9] => 9
)
START END | NUMERIC | DESCEND
Array
(
[0] => 9
[1] => 8
[2] => 7
[3] => 6
[4] => 5
[5] => 4
[6] => 3
[7] => 2
[8] => 1
[9] => 0
)
START END | ALPHABETIC | ASCEND
Array
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
[6] => g
[7] => h
[8] => i
[9] => j
)
START END | ALPHABETIC | DESCEND
Array
(
[0] => j
[1] => i
[2] => h
[3] => g
[4] => f
[5] => e
[6] => d
[7] => c
[8] => b
[9] => a
)
STEP
Array
(
[0] => 0
[1] => 3
[2] => 6
[3] => 9
)