Πέμπτη 24 Ιουλίου 2008

Check PHP script's execution time

An easy way to see how long it takes PHP to run a script:

1) Put this at the top of the page inside the php brackets


$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;



2) Put other code and html


3) 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";




http://www.developerfusion.co.uk/show/2058/

Δεν υπάρχουν σχόλια: