ActiveState Powered by ActiveState

Recipe 208106: Displaying Page Processsing Time


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

PHP
 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";

Sign in to comment