aRo` automating your e-commerce

18Aug/07
This blog has been neglected due to the success of Solidshops.com

capture the loading time of your php pages

If you want to add a feature to your website that shows the loading time of the page just impliment the code below.

Offcourse php is a serverside language so the result is the time needed to generate the html on the server. This does not include sending the page back to the browsers who has to render it. But it's quite accurate.

PHP:
  1. // in the beginning of the page
  2. $start_time = explode(' ', microtime());
  3. $start_time = $start_time[1] + $start_time[0];
  4.  
  5. // at the end of the page
  6. $end_time = explode(' ', microtime());
  7. $total_time = $end_time[0] + $end_time[1] - $start_time;
  8. printf('Page loaded in  %.3f seconds.', $total_time);

Popularity: 2% [?]

Filed under: php Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.