Home > Backend Development > PHP Tutorial > Introduction to PHP 1 for loop

Introduction to PHP 1 for loop

WBOY
Release: 2016-07-28 08:28:09
Original
877 people have browsed it

<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>
Copy after login

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)

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

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template