• 10Nov

    Here in this tutorial, I explain how to break down the foreach loop into a for loop(which in turn is a complex while loop).
    You need flash to play this tutorial.
    This tutorial goes over the following goals:
    For Each loop broken down to a for loop
    A for loop
    You can find this tutorial video on youtube here.

    Here are the sources used in this tutorial:
    tut012.php
    <?php
    //PHP Tutorial 012
    
    $array = array();
    $array[] = "XS";
    
    $array[] = "S";
    $array[] = "M";
    
    $array[] = "L";
    $array[] = "XL";
    
    $howMany = count($array);
    for($x = 0; $x < $howMany; $x++){
    
    	$item = $array[$x];
    	echo $item."<br />";
    
    }
    foreach($array as $item){
    	echo $item."_<br />";
    
    }
    ?>

    Here are all the php functions used in this tutorial:

    Posted by Kloplop321 @ 5:49 pm

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.