1
2<?php
3// array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
4foreach (range(0, 12) as $number) {
5 echo $number;
6}
7
8// The step parameter
9// array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
10foreach (range(0, 100, 10) as $number) {
11 echo $number;
12}
13
14// Usage of character sequences
15// array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i');
16foreach (range('a', 'i') as $letter) {
17 echo $letter;
18}
19// array('c', 'b', 'a');
20foreach (range('c', 'a') as $letter) {
21 echo $letter;
22}
23?>
24
25