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>

0 comments:

Post a Comment

Subscribe to RSS Feed Follow me on Twitter!