|
| Submitted on: |
6/25/2002 1:45:26 PM |
| By: |
Steve Gricci
|
| Level: |
Beginner |
| User Rating: |
By 19 Users |
| Compatibility: |
PHP 3.0, PHP 4.0 |
| Views: |
38782 |
|
(About the author) |
|
|
|
This small script will let you output how much time (in seconds) it took for the page to expell. i.e. 0.501 seconds
|
| |
Terms of Agreement:
By using this article, you agree to the following terms...
- You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
- You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
- You may link to this article from another website, but ONLY if it is not wrapped in a frame.
- You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
|
/*
*@author steve gricci
*@access public
*@skill beginner
*@site www.deepcode.net
*/
//put at begining of file
function utime (){
$time = explode( " ", microtime());
$usec = (double)$time[0];
$sec = (double)$time[1];
return $sec + $usec;
}
$start = utime();
//put at end of page before /body and /html tags
$end = utime(); $run = $end - $start; echo "Page expelled in " . substr($run, 0, 5) . " secs.";
//Nothing after this
|
|
Other 2 submission(s) by this author
|
|
Report Bad Submission
|
Your Vote
|
| |
Other User Comments
|
6/30/2002 12:39:11 AM: Steve Gricci
if anyone wouldn't mind, please vote on this code for me :) (If this comment was disrespectful, please report it.)
|
7/3/2002 9:12:08 AM: Sue
Great code. small and to the point. Just what I was looking for. Thanks. (If this comment was disrespectful, please report it.)
|
8/1/2002 12:27:46 PM: Derrick Simpson
Well, It does a great job of telling how long the server took to process the php, but that has nothing to do with browser rendering time or bandwidth. In fact, you should get almost the very same number regardless of the browser.
The PHP Hypertext Preprocessor generates the html and then the browser loads the page. (If this comment was disrespectful, please report it.)
|
9/21/2002 11:54:01 PM:
I agree with Derrick, it had nothing to do with the browser loading time. (If this comment was disrespectful, please report it.)
|
1/24/2003 1:44:19 PM: paul_cormie
quick and dirty. it's not so much page load time as page creation time.
good code. (If this comment was disrespectful, please report it.)
|
4/1/2003 8:49:44 AM:
This all great material I am just a beginner in php an want to learn as much as possible.
Thank you
Mark (If this comment was disrespectful, please report it.)
|
6/8/2003 11:03:26 AM: Zorg
Finally..lol Ive been looking for ages for this script :) Thx. 5 Globes (If this comment was disrespectful, please report it.)
|
6/8/2003 2:25:43 PM: Steve Gricci
All your positive feedback is astounding. I will be sure to post a few more code samples and possibly a few projects (Open Source of course).
Thank you all, if anyone wants to e-mail me, feel free to. Give me some ideas on what do code next. Thanks. (If this comment was disrespectful, please report it.)
|
7/18/2003 2:11:41 AM: c0ldfyr3
This is actually handy for a number of situations like testing different methods of code, or checking server load at certain times of the day. Why did some guy post about the browser ? This has nothing in the world got to do with the browser or the bandwith lol. (If this comment was disrespectful, please report it.)
|
11/13/2003 6:15:09 PM: D Davis
I dont know where anyone got the idea he said it would work for telling how fast the browser would load. It's very helpful when reading files on the server, or running loops, encrypting something or optimizing your code. Thanks, Good Job! (If this comment was disrespectful, please report it.)
|
2/10/2004 8:04:24 PM:
It would probably be easier to just put this at the beginning of the file
$start_time = microtime();
then at the end
$load_time = round((microtime() - $start_time), 4 );
if (substr($load_time, 0, 1) == "-") { $load_time = substr($load_time, 5); } (If this comment was disrespectful, please report it.)
|
10/3/2005 10:42:34 PM: semie-kun
thanks!!! nice job!!! (If this comment was disrespectful, please report it.)
|
12/8/2012 9:52:52 AM: rkinfo
This course introduces the PHP framework and syntax, and covers in depth the most important techniques used to build dynamic web sites. Students will learn how to connect to any ODBC-compliant database, and perform hands on practice with a MySQL database to create database-driven HTML forms and reports. Students also learn how to configure PHP and Apache Web Server. Comprehensive lab exercises provide facilitated hands on practice crucial to develop competence web sites. php mysql training in coimbatore php mysql training in coimbatore 29,chinna samy road near ayyappan temple sidhapudur, coimbatore tamilnadu india 641044 9578204782 php mysql training in coimbatore COIMBATORE 9578204782 rkinfo.in@gmail.com http://www.rkinfo.in/php-mysql-training-in-coimbatore.html Prerequisites: Basic computer skills, knowledge of HTML fundamentals, (If this comment was disrespectful, please report it.)
|
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)
To post feedback, first please login.
|