I need some information regarding starting and stopping a timer in PHP. I need to measure the elapsed time from the start of my .exe program (I\'m using exec()
For your purpose, this simple class should be all you need:
class Timer {
private $time = null;
public function __construct() {
$this->time = time();
echo 'Working - please wait..
';
}
public function __destruct() {
echo '
Job finished in '.(time()-$this->time).' seconds.';
}
}
$t = new Timer(); // echoes "Working, please wait.."
[some operations]
unset($t); // echoes "Job finished in n seconds." n = seconds elapsed