";}$TmpArray = ["A","B","C","D"];foreach($TmpArrayas$i){echo$i . "
";}?>foreach loop iterates the array, Different from common usage, foreach in C++"/>
";}$TmpArray = ["A","B","C","D"];foreach($TmpArrayas$i){echo$i . "
";}?>foreach loop iterates the array, Different from common usage, foreach in C++">
Home >Backend Development >PHP Tutorial >Introduction to PHP 1 for loop
<code><span><span><?php</span><span>$x</span> = <span>$_GET</span>[<span>'name'</span>]; <span>echo</span><span>$x</span>; <span>for</span>(<span>$i</span> =<span>$x</span>;<span>$i</span><<span>100</span>;<span>$i</span>++) { <span>echo</span><span>$i</span>,<span>"<br>"</span>; } <span>$TmpArray</span> = [<span>"A"</span>,<span>"B"</span>,<span>"C"</span>,<span>"D"</span>]; <span>foreach</span>(<span>$TmpArray</span><span>as</span><span>$i</span>) { <span>echo</span><span>$i</span> . <span>"<br>"</span>; } <span>?></span></span></code>
foreach loop iterates the array, which is different from the common usage, in C++
foreach (zero-time variable in array)
php:
foreach (array as zero-time variable)
The above has introduced PHP entry 1 for loop, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.