Home >Backend Development >PHP Tutorial >range() function in PHP
range() function creates an array containing a range of elements. It returns the elements from start to end.
range(start, end, step)
start - first value
end - the last value
step - the increment in the range
range() function returns the elements from start to end.
The following is an example-
Live Demo
<?php $number = range(0,12,3); print_r ($number); ?>
The following is the output-
Array ( [0] => 0 [1] => 3 [2] => 6 [3] => 9 [4] => 12 )
The above is the detailed content of range() function in PHP. For more information, please follow other related articles on the PHP Chinese website!