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? Link to comment https://forums.phpfreaks.com/topic/61642-page-generation-time/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-306833 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; ?> Link to comment https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-306838 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. Link to comment https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-306847 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. ??? Link to comment https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-306949 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 ??? Link to comment https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-307031 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? Link to comment https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-307706 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 ". Link to comment https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-308232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.