page load 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
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

page load time

Post by bawla »

this is the code im using for page load time

Code: Select all

<?php
 $m_time = explode(" ",microtime());
 $m_time = $m_time[0] + $m_time[1];
 $starttime = $m_time;
?>



<?php
 $round = 8;// The number of decimal places to round the micro time to.
 $m_time = explode(" ",microtime());
 $m_time = $m_time[0] + $m_time[1];
 $endtime = $m_time;
 $totaltime = ($endtime - $starttime);
 echo "" . round($totaltime,$round) ." seconds";
?>
but when it is exicuted i get something like

5.698E-05 seconds
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

why do you have the round up so high?? try setting it to 3, maybe 2
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

just incase you didn't know:

5.698E-05 seconds == .00005698 seconds
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

when i do 2 to 4 i get 0 seconds

at 5 i get something like 4E-05 seconds , which i know equals .00004
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

hmm... thats wierd. for some reason its return in scientific notation. Mine doesn't though. What OS are you running?
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

the server?

its linux
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

hmm... I wonder if anyone else running Linux tries this script if thats what they get too? Im running Windows, and it seems to come out fine for me.
Post Reply