public function execution_time($begin = null)
{
if($begin == null){
return microtime(true);
}
else {
$result = date("H:i:s", microtime(true) - $begin);
return $result;
}
}
I'm trying to count the execution time. But the problem is when execution time is lesser then 1 hour, it writes wrong timestamp, for example:
$timeBegin = execution_time();
sleep(8);
$time_end = execution_time($timeBegin); // it shows 06:00:08
It lasts only 8 seconds, why 6 hours are appear? Why this happens and how to solve this?