";}$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">

首頁 >後端開發 >php教程 >PHP入門1 for循環

PHP入門1 for循環

WBOY
WBOY原創
2016-07-28 08:28:09873瀏覽

<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 零時變數)

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介紹了 PHP入門1 for循環,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn