[SOLVED] how to show page generation time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

[SOLVED] how to show page generation time

Post by dull1554 »

i was wondering how to display page generation time

ex....

Code: Select all

this page was generated in 0.0083 seconds
something like that

i've looked on google and i cant find what i'm looking for, so i thought i'd try here, as always any help would be greatly appreciated.
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

Post by uberpolak »

Check this out, it's a bit lengthy, but I think it's exactly what you're looking for.

http://www.webclass.ru/tut.php?tut=137
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

thats exactly what i wanted, thans a bunch, as i've said before fastest forum ever!!!!!!!!!!!!!!!!!!!
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

Post by uberpolak »

Meh, I work for the government now... Have to kill time on the job somehow.
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

this is the code that i found to do what i want

Code: Select all

//Get current time as we did at start
    $mtime = microtime();
    $mtime = explode(" ",$mtime);
    $mtime = $mtime[1] + $mtime[0];
//Store end time in a variable
    $tend = $mtime;
//Calculate the difference
    $totaltime = ($tend - $tstart);
//Output result
    printf ("Page was generated in %f seconds !", $totaltime);
but there is a undefined $var, $tstart, i tried just changing it to $mtime, but that did not work either can someone tell me what i did wrong
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

sorry i found my mistake, i was being stupid and i left out part of the code
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

<h1>SOLVED</h1>
Post Reply