Query: range
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
RANGE(3) 1 RANGE(3) range - Create an array containing a range of elementsSYNOPSISarray range (mixed $start, mixed $end, [number $step = 1])DESCRIPTIONCreate an array containing a range of elements.PARAMETERSo $start - First value of the sequence. o $end - The sequence is ended upon reaching the $end value. o $step - If a $step value is given, it will be used as the increment between elements in the sequence. $step should be given as a posi- tive number. If not specified, $step will default to 1.RETURN VALUESReturns an array of elements from $start to $end, inclusive.EXAMPLESExample #1 range(3) examples <?php // array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) foreach (range(0, 12) as $number) { echo $number; } // The step parameter // array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100) foreach (range(0, 100, 10) as $number) { echo $number; } // Usage of character sequences // array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'); foreach (range('a', 'i') as $letter) { echo $letter; } // array('c', 'b', 'a'); foreach (range('c', 'a') as $letter) { echo $letter; } ?>NOTESNote Character sequence values are limited to a length of one. If a length greater than one is entered, only the first character is used.SEE ALSOshuffle(3), array_fill(3), foreach. PHP Documentation Group RANGE(3)
Related Man Pages |
---|
array(3) - php |
reset(3) - php |
array_splice(3) - php |
array_unshift(3) - php |
cairo_svg_surface_get_versions(3) - php |
Similar Topics in the Unix Linux Community |
---|
extract last word on line to new file |
How to initialize array with a larger number? |
Novice in C needs help |
Make all words begin with capital letter? |
Reading foreach variable from a text file |