Describe the specific code implementation of PHP computing page execution time. The code for calculating the page execution time using PHP is as follows :? Phpclassruntime {var $ StartTime0; var $ StopTime0; functionget_microtime () {list ($ usec, $ sec) explode (, mi throughThe code for calculating the page execution time in PHP is as follows:
- Php
- Class runtime
- {
- Var $StartTime=0;
- Var $StopTime=0;
-
- Function get_microtime ()
- {
- List ($ usec, $ sec) = explode ('', microtime ());
- Return (float) $ usec + (float) $ sec );
- }
-
- Function start ()
- {
- $ This->StartTime= $ This->Get_microtime ();
- }
-
- Function stop ()
- {
- $ This->StopTime= $ This->Get_microtime ();
- }
-
- Function spent ()
- {
- Return round ($ this->StopTime-$ this->StartTime) * 1000, 1 );
- }
-
- }
-
-
- // Example
- $Runtime=NewRuntime;
- $ Runtime->Start ();
-
- // Start your code
-
- $A=0;
- For ($I=0; $ I<1000000; $ I ++)
- {
- $ A + = $ I;
- }
-
- // Your code ends
-
- $ Runtime->Stop ();
- Echo "page Execution time:". $ runtime->Spent (). "millisecond ";
-
- ?>
By understanding the code for calculating the page execution time in PHP, new users should perform their own operations to deepen their understanding.
The code used to calculate the page execution time in PHP is as follows :? Php classruntime {var $ StartTime = 0; var $ StopTime = 0; functionget_microtime () {list ($ usec, $ sec) = explode ('', mi...