PHP function range()

Availability in PHP 4.0

Create an array containing a range of elements

Parameters

Parameter Data type Default value Note
$low mixed not Low value.
$high mixed not High value.
$step number null 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

array

an array of elements from low to high, inclusive. If low > high, the sequence will be from high to low.

Other resources

Official documentation of the range function

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.