I am making a php timer that i refresh with ajax every second on my page. But i am having problems getting it to work. I need it to countdown 8 minutes. This is the script
<?php
$saveTime = (3600*10); // Saved time from file/database
$thisTime = time(); // Current time
$diffTime = ($saveTime-$thisTime); // Difference in time
if($diffTime >= 1) {
$countMin = floor($diffTime/60);
$countSec = ($diffTime-($countMin*60));
echo 'Time remaining until next run is in ',$countMin,' minute(s) ',$countSec,' seconds';
} else {
echo 'Timer expired.';
}
?>