";}$TmpArray = ["A","B","C","D"];foreach($TmpArrayas$i){echo$i . "
";}?>foreach迴圈迭代數組,跟常見的用法不一樣,C++中foreach"/>
";}$TmpArray = ["A","B","C","D"];foreach($TmpArrayas$i){echo$i . "
";}?>foreach迴圈迭代數組,跟常見的用法不一樣,C++中foreach">
<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循環迭代數組,跟常見的用法不一樣,C++中
foreach (零時變數 in array)
php:
foreach (array as 零時變數)
以上就介紹了 PHP入門1 for循環,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。