← All built-ins / range()

range()

range(int $start, int $end): mixed

Parameters

NameTypeDescription
$startintfirst value
$endintlast value (inclusive)

Return value

List of integers from $start to $end; counts down when $end < $start.

Example

echo implode(",", range(1, 5)), "
";
echo implode(",", range(3, 1)), "
";
1,2,3,4,5
3,2,1

See also

array_fill()count()