Loops (for / foreach / while)
Specific repetitions with for, traversing arrays with foreach, conditional repetition with while.
Simple enough for a 5-year-old to understand
for loop
<?phpfor ($i = 1; $i <= 3; $i++) { echo $i; echo "\n";}🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (1 left)
🎯 Expected output: 1
2
3
4
5