As of PHP 4.1, it is valid for $start to be larger
than $end. In this case, the numbers returned by
range( ) are in descending order. Also, you can
use iterate over character sequences:
print_r(range('l', 'p'));
Array
(
[0] => l
[1] => m
[2] => n
[3] => o
[4] => p
)
The for loop method just uses a single integer and
avoids the array entirely. While it's longer, you
have greater control over the loop, because you can increment and
decrement $i more freely. Also, you can modify
$i from inside the loop, something you
can't do with range( ), because
PHP reads in the entire array when it enters the loop, and changes to
the array don't effect the sequence of elements.