// While Loop
<?php
$g = 0;
while($g <= 5) {
echo "The number is: $g <br>";
$g++;
}
?>
// Foreach Loop
<?php
$programmingLanguage = array("C", "C++", "PHP", "Swift");
foreach ($programmingLanguage as $value) {
echo "$value <br>";
}
?>
// For loop
<?php
for ($x = 0; $x <= 10; $x++) {
echo "The number is: $x <br>";
}
?>
// do while loop
<?php
$g = 0;
do {
echo "The number is: $g <br>";
$g++;
} while ($g <= 5);
?>