Please note, this is a STATIC archive of website webdevelopmenttutorials.com from 20 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.

Tutorials

Learn web design and programming with our free video and text tutorials.

Web Designer? Design and market your own professional website with easy-to-use tools.

PHP foreach Loops Tutorial

PHP foreach loops are used to loop through arrays.

<?php
$arr=array(1, 2, 3, "four", "five", "six");
foreach ($arr as $number)
{
echo "Number: " . $number . "<br />";
}
?>

The code above outputs:

Number: 1
Number: 2
Number: 3
Number: four
Number: five
Number: six