PHP loop 
PHP – While loop: while loops check for the expression. If it is evaluated to true, the subsequent statement is executed.
Example:$ x=5;
While($x <=10) 
{
    Echo x++;
}
PHP – For loop: The for loops are similar to the for loop in C.
For ($x=1; $x<10l; $x++)
{
    Echo $x;
}
PHP for each – PHP for each works best only for arrays.
Syntax: here, the foreach loops over the array given by array_expression. On each loop, the value of the current element is assigned to $value and the internal array pointer is advanced by one.
Foreeach 
{
    array_expression as $value
}
    Statement_to_execute
Example:$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) 
{
    $value = $value * 2;
}