Re: Patch for range()
| From: | Moriyoshi Koizumi | Date: | Sat, 23 Nov 2002 09:48:14 +0000 |
| Subject: | Re: Patch for range() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-91480@lists.php.net to get a copy of this message | ||
Thanks for the review.
Also I'll add a test for this function.
BTW how about renaming it to array_range() and adding an alias for BC?
Moriyoshi
Jon Parise <jon@php.net> wrote:
> On Sat, Nov 23, 2002 at 03:37:29PM +0900, Moriyoshi Koizumi wrote:
>
> > I've just found range() behaves unexpectedly in some special cases.
> >
> > For instance, please try the following script.
> >
> > <?php
> > echo count(range('a', 'z', 12));
> > ?>
> >
> > will give 45 while it should return an array that consists of 3 elements.
> > That is because the counting may exceed the upper limit of positive char
> > value during the loop.
> >
> > The attached patch is a fix for this issue. I'll commit this if there are
> > no objections.
>
> No objections (although I haven't actually applied and run your
> patch). Thanks for investigating this. I should have tested a wider
> set of step values in my original tests.
>
> --
> Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)