We have the following loop types in PHP:
- while - cycles through a block of code as long as the condition specified is true.
- for - iterates across a piece of code a specified number of times.
- For each entry in an array, foreach loops through a piece of code.
Share a personalized message with your friends.