PHP range() FunctionLast Updated : 17 Mar 2025 The PHP range( ) function is used to create an array containing a range of elements. The PHP range( ) function returns an array of elements from low to high. This function was introduced in PHP 4.0. SyntaxParameter
ReturnsThe range( ) function returns array of elements. Example 1Output:
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)
Example 2Output:
Array
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
[6] => g
)
Example 3Output: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, Example 4Output:
(
[0] => z
[1] => y
[2] => x
[3] => w
[4] => v
[5] => u
)
Next TopicPhp-array-reduce-function |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India