Repost from php2000
Author: bigfat
================================
Everyone may always see some of the PHP page
Program Run Time: xxxxx second
Wait for information, how did this do it?
Although PHP has a POSIX series function (
http://www.php.net/manual/en/ref.posix.php)
Can obtain the run time of the program, etc.
But this series of functions cannot run in Windows.
And he got the time does not include mysql and so on.
Therefore, Wanquan is the time to start and end respectively.
Then seek difference
Microtime
http://www.php.net/manual/en/function.microtime.php This function is sent to the field
Test it in the program
PHP
Echo microtime ();
?>
He will output two string numbers
The second is a UNIX timestamp (that is, the stuff obtained by the Time () function)
The first is his millisecond part
So add two parts to get the current precise time.
Function on PHP Mannual
Function getmicrotime () {
List ($ Uses $ sec) = expedition ("", microtime ());
Return (FLOAT) $ uEC (FLOAT) $ sec);
}
Ha ha
So you can try it later.
PHP
Function getmicrotime () {
List ($ Uses $ sec) = expedition ("", microtime ());
Return (FLOAT) $ uEC (FLOAT) $ sec);
}
$ start_time = getmicrotime ();
// Your program
$ END_TIME = getMicrotime ();
Echo 'program runtime';
Echo $ END_TIME- $ start_time ();
?>
Ok, just like this.
With this function and the POSIX function, you can also get the PHP and MySQL time to get smart yourself to explore!