View Single Post
  #2  
Old 07-21-2007, 12:40 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 632
oxygen is on a distinguished road
Default Re: Determine execution time in PHP

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";
;?>
Reply With Quote