I'm working on a timing application and am having trouble fine tuning the time calculations.
In a nut shell, I'm timing how long something takes. I record a time stamp at the start, and timestamp at the end, then calculate the difference between the two times.
// $t1 and $t2 are timestamps defined earlier in the code
$starttime = strtotime($t1);
$endtime = strtotime($t2);
$t = $endtime - $starttime; // calculates time in seconds
$t = $t / 60; // converts to minutes
This is pretty straight forward, and it works. The problem is dealing with remainders. For example...
$t1: 11:37:47
$t2 : 11:45:22
The code above calculates the difference as 7.58333.
How do I take 7.58333 and convert the remainder to seconds (i.e. 7:35)?