Library code snippets
Determine execution time in PHP
By gringod, published on 08 Mar 2002
This code is based on the ASP script posted by Lio. It will determine the time taken for a php script to execute correct to 0.000000000000001 seconds.
<!-- put this at the top of the page -->
<?php
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
;?>
<!-- put other code and html in here -->
<!-- put this code at the bottom of the page -->
<?php
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
echo "This page was created in ".$totaltime." seconds";
;?>
Related articles
Related discussion
-
Im having problems updating a mysql database with php using a form
by chris jonesy (3 replies)
-
Sending Multiple ListBox Selection to PHP
by cnrez (6 replies)
-
A particular gallery image
by margy80 (0 replies)
-
code highlighting using jquery
by pjm (1 replies)
-
PHP London July Meetup
by Dalton (0 replies)
Related podcasts
-
EarthClassMail.com - Moving from LAMP to .NET 3.5
Scott chats with Matt Davis, architect at EarthClassMail.com, about their move from a LAMP stack (Linux/Apache/mysql/PHP) to .NET 3.5. What's working, what's not, and what kinds of issues are they running into as their architect their solution.
Events coming up
-
Jul
18
WordCamp UK 2009
Cardiff, United Kingdom
This is the second WordCamp UK - an informal annual gathering of WordPress publishers, designers and developers based in the United Kingdom.
the code simple and easy to implement
thanks to you!
great... very useful. thank you
This thread is for discussions of Determine execution time in PHP.