plutomed Posted July 25, 2007 Share Posted July 25, 2007 I have the code and it works: <? $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $start = $time; //Page code $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $finish = $time; $totaltime = ($finish - $start); ?> I was wondering if I could echo the gen. time halfway down the page, would it be posible? Quote Link to comment Share on other sites More sharing options...
evillair Posted July 25, 2007 Share Posted July 25, 2007 Try adding this to where you want it to display <?php printf ("Page created in %f seconds.", $totaltime); ?> Quote Link to comment Share on other sites More sharing options...
trq Posted July 25, 2007 Share Posted July 25, 2007 <?php $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $start = $time; //Page code $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $finish = $time; $totaltime = ($finish - $start); echo $totaltime; // more code. $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $finish = $time; $totaltime = ($finish - $start); echo $totaltime; ?> Quote Link to comment Share on other sites More sharing options...
plutomed Posted July 25, 2007 Author Share Posted July 25, 2007 Try adding this to where you want it to display <?php printf ("Page created in %f seconds.", $totaltime); ?> Can't be working: Page created in 0.000000 seconds. Quote Link to comment Share on other sites More sharing options...
evillair Posted July 25, 2007 Share Posted July 25, 2007 This is the code I am using... I have this in the header: // Load time stuff $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $start = $time; Then in my footer I have: $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $finish = $time; $totaltime = ($finish - $start); //printf ("Page created in %f seconds with %g queries.", $totaltime, $num_queries); if ($show_footertime == '1') { printf ("Page created in %f seconds.", $totaltime); It works for me. ??? Quote Link to comment Share on other sites More sharing options...
plutomed Posted July 25, 2007 Author Share Posted July 25, 2007 It works if I have this in the footer <? printf ("Page created in %f seconds.", $totaltime); ?> But I don't want it there I want it half way down the page ??? Quote Link to comment Share on other sites More sharing options...
evillair Posted July 26, 2007 Share Posted July 26, 2007 Odd, it should work anywhere. I just added it to the footer because of the way my site is. Have you tried what thorpe posted? Quote Link to comment Share on other sites More sharing options...
evillair Posted July 26, 2007 Share Posted July 26, 2007 I found this, works great: http://www.zend.com/code/codex.php?id=731&single=1 Just change the "Dauer: " to "Page created in ". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.