Q Question Everything! New member Jul 12, 2009 #1 What is the most accurate and reliable php script that displays the time it took for the page to load? One that can be placed at the top only?
What is the most accurate and reliable php script that displays the time it took for the page to load? One that can be placed at the top only?
G glynn.alexander New member Jul 12, 2009 #2 put this code at the very top of your webpage <? $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $start = $time; ?> and this at the very bottom <? $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo '<p>Page generated in '.$total_time.' seconds.</p>'."\n"; ?> this is how it will look Page generated in 0.0031 seconds
put this code at the very top of your webpage <? $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $start = $time; ?> and this at the very bottom <? $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo '<p>Page generated in '.$total_time.' seconds.</p>'."\n"; ?> this is how it will look Page generated in 0.0031 seconds