Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
Never? What about when you want count() executed every loop becaue you are changing the length of the array within the loop?
I agree it should not be used when iterating over the entire array. But never?
I would also like to note that the speed of the loop instruction is often an insignificat part of the time it takes to execute the instructions within the loop.
foreach will likely be faster due to the fact that it essentially does the same as you are doing in the for loop, but it is written in C and that makes it faster to execute
Hades wrote:foreach will likely be faster due to the fact that it essentially does the same as you are doing in the for loop, but it is written in C and that makes it faster to execute
All of PHP is written in C. What's the point you're making?