4 Types of Loops in PHP
PHP for loop can be used to repeat the set of code for the specified number of times.
while() — Loops through a block of code as long as the condition specified equal to true.
do()…while() — The block of code executed once and then the condition is evaluated. If the condition is true the statement is repeated as long as the specified condition is true.
for() — PHP for loop can be used through a set of codes for the specified number of times.
foreach() — Loops through a block of code for each element in an area