range( ) function creates an array of numbers between a low value and a high value. : range « Utility Function « PHP






range( ) function creates an array of numbers between a low value and a high value.

 
Get an array of the sequential numbers between 1 and 40 (inclusive)
<?
    $numbers = range(1,40);
    print_r($numbers);
?>
  
  








Related examples in the same category

1.range( ) function has a third parameter that allows you specify a step amount in the range.
2.If your low parameter (parameter one) is higher than your high parameter (parameter two), you get an array counting down, like this:
3.Initializing an Array As a Range or Sequence of Values: array range(mixed $start, mixed $end[, mixed $step])
4.Use range( ) to create arrays of characters, like this: