PHP Programing language

array_range() Function in PHP
Previous Home Next

array_range()

The range() function creates an array containing a range of elements and it returns an array of elements from low to high.

Syntax:
range(low,high,step)

In above syntax, "low" specifies the lowest value of the array, "high" specifies the highest value of the array and "step" specifies the increment used in the range and default range is 1

Example:

<?php
$num = range(40,100,10);
print_r ($num);
?>

Output:

Array ( [0] => 40 [1] => 50 [2] => 60 [3] => 70 [4] => 80 [5] => 90 [6] => 100 )

Previous Home Next