php.net |  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
Votes:1
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-23 14:42 UTC] datibbaw@php.net
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] maarten@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2013-07-12 12:44 UTC] maarten@php.net
Just add an if condition for your business rules where you expect an empty array.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC