For Loops in PHP

For loops execute the code number of times.:
dzone img The if statement executes some code if a condition is true .

Syntax:
for (init number; test number; increment number)
{
code to be executed; }

Example:

<?php
for ($x = 0; $x <= 10; $x++) {
    echo "The number is: $x <br>";
}
?>
The PHP foreach Loop:

The foreach loop used only print arrays values , and is used to loop through each key/value pair in an array.

Syntax:
foreach ($array as $value)
{
code to be executed;
}

Example:

<?php
$arr = array(1, 2, 3, 4);

foreach ($arr as $value) {
    echo "$value <br>";
}
?>
Learn PHP If-else Conditions:   We have the following conditional statements in PHP language
Learn PHP loops:  For loops execute the code number of times.
PHP Form Submission:  For post data superglobals $_GET and $_POST are used in php.
Learn PHP array:  An array stores multiple values in one single variable