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
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Explanation of code

    Could someone comment on this code and tell me what it does? [edit] I know what it does, but what exactly it is doing is what I need to know

    I am using this code and I really like to understand what is going on in the code I use. Thanks
    PHP Code:
    <?php
            $stimer 
    explode(' 'microtime());
            
    $stimer $stimer[1] + $stimer[0];
            
            
    $etimer explode(' 'microtime());
            
    $etimer $etimer[1] + $etimer[0];
            
    /* I know what is going on from here down */
            
    echo "<center><font size='2'>";
            
    printf("Page rendered in <b>%f</b> seconds"$etimer-$stimer);
            echo 
    '</center></font>';
    ?>
    Thanks to all
    Last edited by SDP2006; 03-23-2004 at 12:23 AM.
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    See http://www.php.net/microtime and http://www.php.net/explode
    PHP Code:
    <?php
            
    // splits the time at the space
            
    $stimer explode(' 'microtime());
            
    // Puts the times together (seconds and milliseconds)
            
    $stimer $stimer[1] + $stimer[0];
           
            
    // Does exactly the same as above 
            
    $etimer explode(' 'microtime());
            
    $etimer $etimer[1] + $etimer[0];

            
    /* I know what is going on from here down */
            
    echo "<center><font size='2'>";
            
    printf("Page rendered in <b>%f</b> seconds"$etimer-$stimer);
            echo 
    '</center></font>';
    ?>
    Last edited by Nightfire; 03-23-2004 at 12:37 AM.

  • #3
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thats simple enough, thanks Nightfire
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!


  •  

    Posting Permissions

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