Jump to content

BigEL

New Members
  • Posts

    1
  • Joined

  • Last visited

BigEL's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.