#15920 [Csd]: range() with a step parameter

From: Date: Sat, 08 Feb 2003 18:56:52 +0000
Subject: #15920 [Csd]: range() with a step parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32509@lists.php.net to get a copy of this message
ID: 15920 Updated by: moriyoshi@php.net Reported By: pgerzson@freestart.hu Status: Closed Bug Type: Feature/Change Request Operating System: Any PHP Version: 4.1.2 New Comment: No, sorry, this request is realised in CVS versions you can fetch at http://snaps.php.net/ Previous Comments: ------------------------------------------------------------------------ [2003-02-08 12:55:30] moriyoshi@php.net Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php ------------------------------------------------------------------------ [2002-03-06 20:54:25] pgerzson@freestart.hu I think it would be useful in some situation if the range() function can take a third optional parameter (called "step" or whatever you want) which specifies the space between two consecutive elements in the resulting array. For example: $array = range(1, 5, 2); // array(1,3,5); It might be always positive to understand its effect easily. $array = range('Z', 'A', 3); // array('Z', 'W', 'T', 'Q', ...); If the second boundary cannot be included regarding to the step parameter, just simply leave it out: $array = range(1, 6, 2); // array(1,3,5); That's all. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15920&edit=1

« previous php.bugs (#32509) next »