Announcement

Collapse
No announcement yet.

Time Taken To Load A Page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Time Taken To Load A Page

    How to do in php the time take to load a page, like for example

    php process this page in $time seconds


    Pleas Help Thanks

  • #2
    I took this right from vB, so it should work.

    Add this right after <?php in the file, like this:
    PHP Code:
    <?php
    $pagestarttime
    =microtime();
    Now add this right before ?>, like this:
    PHP Code:
    $pageendtime=microtime();
    $starttime=explode(" ",$pagestarttime);
    $endtime=explode(" ",$pageendtime);
    $totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
    ?> 
    Now use $totaltime.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment


    • #3
      the above code can worked only if the whole page is script in php even html tages must use print or echo.

      What about this code.
      PHP Code:
      $mtime microtime();
      $endtime $mtime;
      $totaltime = ($endtime $starttime);
      printf('<div align="center">PHP Processes This Page In %f seconds.</div>'$mtime); 
      it works, but i dunno whether is it the real processing time. I am quite new to these php programming, pardon me for my mistakes.

      Thanks
      Last edited by GamerZ; Mon 24 Sep '01, 4:37pm.

      Comment


      • #4
        thats a cool, script, I just tested it on my site, and according to it, it loads up the forum home in 0.005812 seconds

        Comment


        • #5
          Originally posted by Steviepowers
          thats a cool, script, I just tested it on my site, and according to it, it loads up the forum home in 0.005812 seconds
          ya mine abt teh same

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X