PHP Code Snippet: Page Load Speed Test Generated Script

Mobile
feeds
Welcome Login | Register

PHP Code Snippet: Page Load Speed Test Generated Script
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » Snippets Forums
        » » PHP Code Snippet: Page Load Speed Test Generated Script
PHP Code Snippet: Page Load Speed Test Generated Script
Post Description: php code snippet page load speed test generated script Snippets
Post Tags:
This Post Has Been Viewed 4588 Times Since Fri Jul 28, 2006 9:14 am Author hostman with 5 replies
PHP Code Snippet: Page Load Speed Test Generated Script
Advertise On This Page




Put the following code at the very beginning of your PHP page.


     Code:
<?
# Page Load Test Script by Webune.com
# http://www.webune.com/forums/
$load_time = microtime();
$load_time = explode(' ',$load_time);
$load_time = $load_time[1] + $load_time[0];
$page_start = $load_time;

?>


Now put the folowing code at the bottom of your page. I suggest you put it just right before the </body></html> TAGS..


     Code:
<?
$load_time = microtime();
$load_time = explode(' ',$load_time);
$load_time = $load_time[1] + $load_time[0];
$page_end = $load_time;
$final_time = ($page_end - $page_start);
$page_load_time = number_format($final_time, 4, '.', '');
echo("Page generated in " . $page_load_time . " seconds");

?>


That's it. Load you page and you will see a message at the bottom of the page telling you how long it takes for your web page to load. Look at the bottom of you page where it says: Page generated in xx.xx seconds


View Demo: http://www.webune.com/tutorials/page-load.php


Leave Your Comments

Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments
Share
| More
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Subscribe Feeds
Webmasters - Exchange Links With Us. Add related websites to this topic
Add Link:
Links Related to : PHP Code Snippet: Page Load Speed Test Generated Script

Comments and replies About PHP Code Snippet: Page Load Speed Test Generated Script
:: 1 :: Reply #11311 Reply By adrian On Tue Jul 17, 2007 5:31 pm
adrian:
nice script you have here! :d
:: 2 :: Reply #51940 Reply By camilord On Mon Apr 28, 2008 9:44 am
camilord:
hehehehe.. i already have this script. but i always forgot to save in my hdd.. hehehehe.. anyway, thanks again...
:: 3 :: Reply #71141 Reply By anoop On Fri Sep 19, 2008 4:04 am
anoop:
nice code to count time it helps me very much....
:: 4 :: Reply #91023 Reply By bernhard On Thu Jan 22, 2009 12:29 pm
bernhard:
thank you. the script helps me to save the download time of a video to see connection times during the day.
:: 5 :: Reply #102156 Reply By yashrai On Sun May 03, 2009 12:38 am
yashrai:
any demo plz..................