Showing posts with label Example code for Loops pointers in php. Show all posts
Showing posts with label Example code for Loops pointers in php. Show all posts

Example code for Loops pointers in php :


<html>
    <head>
        <title>Loops: pointers</title>
    </head>
    <body>
    <?php
   
        $ages = array(43, 84, 154, 146, 213, 142);
    ?>
    <?php
       
        echo "1: " . current($ages) . "<br />";
        next($ages);
        echo "2: " . current($ages) . "<br />";
        reset($ages);
        echo "3: " . current($ages) . "<br />";
    ?>
    <br />
    <?php
       
        while ($age = current($ages)) {
            echo $age . ", ";
            next($ages);
        }
    ?>
    </body>
</html>
Subscribe to RSS Feed Follow me on Twitter!