//define range limits
$x = 10;
$y = 36;
// generate range as array
// result: (10, 11, 12...35, 36)
$range = range($x, $y); print_r($range);
// define range limits
$x = 10;
$y = 30;
// generate range as array
// contains every third number
// result: (10, 13, 16, 19, 22, 25, 28)
$range = range($x, $y, 3);
print_r($range);
// print multiplication table
foreach (range(1, 10) as $num) {
echo "5 x $num = " . (5 * $num) . "\n";
}
Tuesday, October 21, 2008
Generate a number List /Range
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment