01 <?php
02
03 // put this in the top of your script
04 function get_microtime()
05 {
06 list($usec, $sec) = explode(' ',microtime());
07 return ((float)$usec + (float)$sec);
08 }
09
10 $time_start = get_microtime();
11
12 // start page content here
13
14 // this is dummy - content to spend some time
15 for ($i=0; $i < 1000; $i++)
16 {
17 }
18
19 // end page content here
20
21 // compute and output load-time in milliseconds
22 $time_end = get_microtime();
23 $time = $time_end - $time_start;
24 $time = round($time,6);
25
26 echo '<p>this page loaded in '.$time.' seconds.</p>';
27
28 ?>