PHP : Loop
while
while (condition is true) {
code to be executed;
}
for
for ($x = 0; $x <= 10; $x++) {
echo "The number is: $x ;
}
foreach
// loop through array
$colors = array("red", "green", "blue", "yellow");
foreach ($colors as $value) {
echo $value;
}
//with index
foreach($array as $key=>$value) {
// do stuff
}
//loop through array of arrays
foreach ($recordArray as $value) {
print_r($value);
}