cragllo
Jul 5 2006, 01:47 PM
As my knowledge of PHP increases, I have learned more, in this version, I use a class. V1: http://www.trap17.com/forums/page-loading-time-t4782.htmlCODE <?php class microtimer { // Starts, Ends and Displays Page Creation Time function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function s() { $this->st = $this->getmicrotime(); } function e() { $this->et = $this->getmicrotime(); echo round(($this->et - $this->st), 6); } }
$tm = new microtimer;
//A class is a collective function set. Stick that in a file that's included or in the file you're running //then you use it as follows:
$tm->s();
//put all you PHP code and site code in here
$tm->e();
//and it will display the execute time in seconds to 6 decimal places. Generally i get results such as 0.000158 //just stay aware that php is extremely fast so if it's a small piece of code you'll get lots of 0s on the left ?>
Reply
B4ND1T
Jul 5 2006, 11:57 PM
QUOTE(cragllo @ Jul 5 2006, 03:47 PM)  As my knowledge of PHP increases, I have learned more, in this version, I use a class. V1: http://www.trap17.com/forums/page-loading-time-t4782.htmlCODE <?php class microtimer { // Starts, Ends and Displays Page Creation Time function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function s() { $this->st = $this->getmicrotime(); } function e() { $this->et = $this->getmicrotime(); echo round(($this->et - $this->st), 6); } }
$tm = new microtimer;
//A class is a collective function set. Stick that in a file that's included or in the file you're running //then you use it as follows: $tm->s();
//put all you PHP code and site code in here
$tm->e();
//and it will display the execute time in seconds to 6 decimal places. Generally i get results such as 0.000158 //just stay aware that php is extremely fast so if it's a small piece of code you'll get lots of 0s on the left ?> tnx man
Reply
wappy
Jul 6 2006, 09:34 AM
Ah so the original one is not accurate? I put it on my wap site but use explode to get rid of the E. I had a feeling the start needed to be at the top of code and vice versa lol. Ah well it still looks cool untill i use the new code. Im sure on php.net i read a way to shorten strings.. I will look again at some point as for my tiny wap site the number seems very long, i would have maybe just like 1.65824 ;-)
Reply
cragllo
Jul 6 2006, 01:41 PM
If you wnat the number to have less numbers after its decimal place, simple edit this code CODE function e() { $this->et = $this->getmicrotime(); echo round(($this->et - $this->st), 6); //Change this number here }
Reply
Recent Queries:--
"php page loading" - 250.49 hr back. (1)
Similar Topics
Keywords : loading v2 load- Help Php: How To Load String From Text File (solved)
- Loading string from text file when you click on your link (9)
- Page Loading Time
- how long does your page take to load? (7)
All you have to do is add this code to your page where you want the loading time to be shown, the
bottom is the most common place. CODE <?php $loadbegintime = microtime();
$loadbeginarray = explode(" ", $loadbegintime); $loadbegintime =
$loadbeginarray[1] + $loadbeginarray[0]; $loadendtime =
microtime(); $loadendarray = explode(" ", $loadendtime);
$loadendtime = $loadendarray[1] + $loadendarray[0];
$total_script_time ...
Loading Mysql Data Into A Table
- (10)
Hey i have a little problem with my php script. i dont really know how to make it work ^^; I want to
have this exact table: ' I made mysql table that has one column for id(auto-increment,
primary key), and then it has row and collumn and text. row means which row in the html table and
collumn wich collum. (obviously /tongue.gif" style="vertical-align:middle" emoid=":P" border="0"
alt="tongue.gif" />) here is the mysql table screenshoted from phpMyAdmin: r means row and c
collumn /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue...
Loading Some Of The Title From The Include Tag
- (2)
Let's say I have the same PHP script on all pages, with the same menus, footer etc, but with
different content. The PHP page is called "Sitename - ", and the included pages (which is in HTML)
is called "Thingy". I want it to load both titles, so the title will be "Sitename - Thingy". The
second page have the same PHP code (with the normal title, "Sitename - "), but is called "Why not?".
This one have the title "Sitename - Why not?". Hope you understand what I want, and that you can
help me. /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ...
Looking for page, loading, time, v2, long, page, load
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for page, loading, time, v2, long, page, load
*MORE FROM TRAP17.COM*
|
advertisement
|
|