In addition for our page we can displaying information how much some page processing spend time occurs by measure script time running. principle is simple with substract time_ending with time_start
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ### begin page
## this must be write on 1st line before do anything
$_start_time=time();
### your codes begin here.......
##and here .................
##.... until your code ends
## on footer, when process is done we can calculate time with
$_time_spend=time()-$_start_time;
echo "This page needed $_time_spend second";
|
Why reinventing the wheel?
See php microtime()'s manual entry on http://cz.php.net/microtime, and look for example named "Example #1 Timing script execution with microtime()" or "Example #2 Timing script execution in PHP 5".
It is more accurate, because it returns number of miliseconds as well.