class Timer//Page execution time class
{
var starttime;//Page start execution time
var stoptime;//Page end execution time
var spendtime;//Page execution time spent
function getmicrotime()//Get the current microseconds returned Floating point number
{
list(usec,sec)=explode(" ",microtime());
return ((float)usec + (float)sec);
}
function start()//The page starts executing the function and returns the time when the page was executed
{
this->starttime=this->getmicrotime();
}
function display()// Display the page execution time
{
this->stoptime=this->getmicrotime();
this->spendtime=this->stoptime-this->starttime;
return round(this->spendtime,10);
}
}
/*Call method
timer=new Timer();
timer->start();
/*Put the script or code you want to execute here
for(i=0;i<100000;i++)
{
echo i;
echo "
" ;
}
*/
//echo "
It takes time to execute this code".timer->display()."seconds";
?>