Learn how to output the time a page takes to load.
Have you every wondered how sites get that “Page loaded in x.xxx seconds.” at the bottom of there pages? It is very simple to do and can be done with any server-side scripting language. I will show you how to do it in PHP.
The script is very simple. First it gets the micro time as the start time. Then at the end it gets the micro time again and finds how many micro seconds have past.
Place this code at the top of your page:
$starttime = explode(' ', microtime()); $starttime = $starttime + $starttime;
Place this code at the bottom of your page:
$mtime = explode(' ', microtime()); $totaltime = $mtime + $mtime - $starttime; printf('Page loaded in %.3f seconds.', $totaltime);