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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kenaniah at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 11:01:32 2025 UTC