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 |
---|
usort(3) - php |
reset(3) - php |
array_splice(3) - php |
array_unshift(3) - php |
ctype_punct(3) - php |
Similar Topics in the Unix Linux Community |
---|
foreach shell question |
Create range from a list |
Deleting sequences based on character frequency |
Novice in C needs help |
Reading foreach variable from a text file |