Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php number sequence - range?

    I'm simply trying to come up with a way to display numbers in a sequence, starting with one (similar to a numbered list - <ol> - in html). The difference is that I want to retrieve the numbers at different point throughout the page...there will be various content between each in other words. Below is what I've come up with thus far, which doesn't work properly. Also, is there a way to make it so that there isn't a limit in the range?

    PHP Code:
    <html>
    <head>
        <title>Untitled</title>
    </head>

    <body>

    <?php
    foreach (range(0100) as $number) {
    }

    ?>

    <p><?php echo $number ?></p>

    <p>content a</p>

    <p><?php echo $number ?></p>

    <p>content b</p>

    <p><?php echo $number ?></p>

    </body>
    </html>
    Last edited by AshleyQuick; 03-03-2005 at 08:34 PM.

  • #2
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <?
    $number = 0;
    ?>
    
    ..
    <p><?=++$number?></p>
    ...
    <p><?=++$number?></p>
    ...
    <p><?=++$number?></p>
    Like that?

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Exactly! Thank you.


  •  

    Posting Permissions

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