Hello PHP Internals, I would like to propose introducing a new language
construct called loop, designed for executing a block of code a specified
number of times. The proposed syntax is: loop(10) { // Code executed
exactly 10 times } The motivation is to provide a simple and readable
alternative to using a for loop when the iteration counter is not needed.
Currently, developers typically write: for ($i = 0; $i < 10; $i++) {
doSomething(); } With the proposed construct: loop(10) { doSomething();
} The initial proposal is intentionally minimal: No iteration counter. The
argument specifies the exact number of iterations. The argument is evaluated
only once. break and continue should behave as they do in existing loops. A
count of zero results in no iterations. This construct is not intended to
replace for, foreach or while, but to provide a simpler alternative for a
common use case. I would appreciate feedback on whether this proposal would be
worth pursuing as a formal PHP RFC. At this stage, I am proposing the concept
and would also welcome advice regarding implementation in PHP Core. Best regards