php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42535 repeat() loop
Submitted: 2007-09-03 20:27 UTC Modified: 2007-09-03 23:20 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: kenaniah at gmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.4 OS:
Private report: No CVE-ID: None
 [2007-09-03 20:27 UTC] kenaniah at gmail dot com
Description:
------------
Granted, you can replicate this by using

while($i=0;$i<$times;$i++){
//code here
}

but that defeats the doctrine of simplicity...

Is a language construct such as 

repeat($times){
//code here
}

really that much to ask for?

My proposal:

<b><i>void </i>repeat (<i>$times</i>, <i>[&$counter]</i>)</b> where counter is a reference to a variable that will be incremented upon each iteration.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-03 23:20 UTC] johannes@php.net
There is no need for such a limited language construct. for, foreach, while, do..while, ... are enough loops.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 19:01:31 2024 UTC