I have a PHP countdown clock that I is going to be put on my website but am struggling to debug some errors. When the clock shows 1 minute it still says "1 Minutes" (notice the S in minutes) and it also displays "0 minutes". I have posted a copy of my code below.
<?php
countdown(2011,6,7,7,31,0);
function countdown($year, $month, $day, $hour, $minute){
$the_countdown_date=mktime($hour, $minute, 0, $month, $day, $year, -1);
$today=time();
$difference=$the_countdown_date - $today;
$days=floor($difference/60/60/24);
$hours=floor(($difference - $days*60*60*24)/60/60);
$minutes=floor(($difference - $days*60*60*24 - $hours*60*60)/60);
echo "$days days $hours hours $minutes minutes";
}
?>
Is there any way I can get it to say "1 minute" and not display the minutes section for "0 minutes"?
I hope people can understand this. Thanks in advance
Callum