note 45285 added to function.range
| From: | donwilson at gmail dot com | Date: | Wed, 01 Sep 2004 04:38:10 +0000 |
| Subject: | note 45285 added to function.range | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75814@lists.php.net to get a copy of this message | ||
To speed your MyRange() function, I have created a much nicer function with less code to sift
through to include the step parameter.
<?php
// range() limitation for PHP <5.0.0
function myRange($num1, $num2, $step=1)
{
for($i = $num1; $i <= $num2; $i += $step)
{
$temp[] = $i;
}
return $temp;
}
?>
For whatever reason my comment was deleted..?
----
Manual Page -- http://www.php.net/manual/en/function.range.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45285
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45285&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45285&report=yes
Search -- http://master.php.net/manage/user-notes.php