range() — php array function

The range() array function in PHP will create a new array using a specified range. You can use letter or number ranges.The range() function creates an array containing a range of elements.This function returns an array of elements from low to high.

Syntax:

array range ( int low, int high [, int step])

Example

  
$questions = range(1, 10, 2);
 // gives 1, 3, 5, 7, 9

 $questions = range(1, 10, 3)
 // gives 1, 4, 7, 10

 $questions = range(10, 100, 10);