0

Can for loop execute without initialization?

23rd Dec 2019, 2:31 PM
Nitya
Nitya - avatar
2 ответов
+ 2
Yes, for loop can execute without initialization IF a variable used for loop counter, or a variable needed is already defined before the loop. For example: $i = 1; for(; $i <= 5; $i++) // no initiailization { echo $i . '<br />'; }
24th Dec 2019, 12:01 PM
Ipang
+ 1
Thank you.
26th Dec 2019, 11:49 AM
Nitya
Nitya - avatar