```
/**
* 循环
* For
* While
* Do...While
* Foreach
*/
# For 循环
# @params - init , condition , increament
for ($i = 0; $i < 10; $i++) {
echo $i;
echo '<br>';
}
# While 循环
$i = 0;
while ($i < 10) {
echo $i;
echo '<br>';
$i++;
}
# Do... While
$i = 0;
do {
echo $i;
echo '<br>';
$i++;
}
while($i < 10);
# Foreach
$people = array('aa', 'bb', 'cc');
for ($i=0; $i<count($people); $i++) {
echo $people[$i] . '<br>';
}
foreach($people as $person) {
echo $person.'<br>';
}
$people = [
"aa" => "aa@gmail.com",
"bb" => "bb@gmail.com",
"cc" => "cc@gmail.com"
];
foreach ($people as $person => $email) {
echo $person. ":" .$email; // $person: key, $email: value
echo "<hr>";
}
```