PHP

Getting Started String Date If Else Loop Array Functions Session Files Super Global Variables Debugging MySQL MySQL Read Data JSON Markdown
O O

Weather Controls

Time Of Day
Rain
Wind Speed
Wind Direction
Clouds

PHP : Loop

2022-07-19

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);
}