PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular

range

Tags: PHP 5.x PHP 7.x PHP 8.x

range — Create an array containing a range of elements.

Description

range(
    string|int|float $start, 
    string|int|float $end, 
    int|float $step = 1
): array
Create an array containing a range of elements.

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 Values

Returns an array of elements from start to end, inclusive.