Find out for how long the script was running for in seconds?

Emorearmany

New Member
I have a script which runs in a 'while' cycle. I need to determine for how long the script was running for and if it is over 10 seconds terminate it. The code I wrote returns weird decimal values (one second it might be '5.342...' and other it might be '903.322...').Can someone tell me how can I achieve that?\[code\]$timer = microtime(false);while(/*...*/){ $currTime = microtime(false); $timeDiff = $currTime - $timer; $timeDiff *= 1000; if ($timeDiff > 10) { //... }}\[/code\]
 
Back
Top