I'm pretty new to PHP and so far i've written a function to echo the next game in a schedule. Problem is, I want to display "Today" if there is a game today. Currently if today's date = $today, nothing gets displayed . I've tried an elseif statement inside the foreach, but with no results.
If anyone could point me in the right direction, that be great. Thanks.
function next_game(){
$schedule = array(
'vs. team1 ' => strtotime('17 Dec 2012'),
'vs. team2 ' => strtotime('19 Dec 2012'),
'@team3 ' => strtotime('22 Dec 2012'),
'@team4 ' => strtotime('4 Jan 2012')
);
$today = time();// current timestamp[/background][/size][/font][/color]
foreach($schedule as $place => $date){
if($date > $today) {
echo date('M dS', $date)."<small>".$place."</small>";
break;
}
}
}
Output
Dec 23rd<small>@FGC </small>