Return to Snippet

Revision: 2907
at May 4, 2007 04:15 by kotnik


Initial Code
// put this at the top of the page
   $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
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $endtime = $mtime;
   $totaltime = ($endtime - $starttime);
   echo "This page was created in ".$totaltime." seconds";

Initial URL

                                

Initial Description
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.

Initial Title
php code exution time

Initial Tags
php

Initial Language
PHP