首页  >  文章  >  后端开发  >  PHP入门1 for循环

PHP入门1 for循环

WBOY
WBOY原创
2016-07-28 08:28:09852浏览

<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>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