|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #17565 optional ORDER parameter for range()
Submitted: 2002-06-02 05:52 UTC Modified: 2013-07-12 12:44 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bigredlinux at yahoo dot com Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bigredlinux at yahoo dot com
New email:
PHP Version: OS:


 [2002-06-02 05:52 UTC] bigredlinux at yahoo dot com
The range() function has the ability to generate a range from one number (or character) to another.  It states in the documentation that if the first number (character) is greater than the second, it creates a decreasing range.  However, the problem is, sometimes you don't want it to switch range order, so it would be nice to have a third parameter which states the direction or states whether you want it to auto flip.  Hence, if I did

range(9, 0, ASC)

it would generate an empty array...

or prehaps I could do

range(9, 0, false)

for not autoflipping.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-23 14:42 UTC]
range() now has that option since 5.0, though it will still assume the step size 
is negative when the start value is higher than the end value.
 [2013-07-12 12:44 UTC]
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2013-07-12 12:44 UTC]
Just add an if condition for your business rules where you expect an empty array.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sat Oct 20 06:01:26 2018 UTC