www.webdeveloper.com
Results 1 to 3 of 3

Thread: foreach loop plz

  1. #1
    Join Date
    Dec 2012
    Posts
    2

    Question foreach loop plz

    hi dears this is yasir plz i m new with php i want to learn about FOREACH loop and use of foreach loop .
    thanks waiting for reply ..............

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,148
    I would start here: http://www.php.net/foreach
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Apr 2013
    Posts
    135
    The foreach loop is used to loop through arrays.
    Syntax:
    foreach ($array as $value)
    {
    code to be executed;
    }
    For every loop iteration, the value of the current array element is assigned to $value and the array pointer is moved by one - so on the next loop iteration, you'll be looking at the next array value.
    Example:
    <html>
    <body>

    <?php
    $x=array("one","two","three");
    foreach ($x as $value)
    {
    echo $value . "<br>";
    }
    ?>

    </body>
    </html>
    Output:
    one
    two
    three

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles