All pastes #265610 Raw Edit

Robert

public php v1 · immutable
·published 2006-12-03 13:17 UTC
rendered paste body
class DateRange{  function getMonthNames($shorthandMonths = false)  {    $monthsLonghand = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");    $monthsShorthand = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec");    return $shorthandMonths ? $monthsShorthand : $monthsLonghand;  }  /**  *  *  *  **/  function getYears()  {    $startingYear = date("Y") - TOTAL_YEARS;    $bufferYears = array();    for($count = $startingYear; $count <= date("Y"); $count++)      $bufferYears[] = $count;    return $bufferYears;  }  /**  *  *  *  **/  function getMonths()  {    $bufferMonths = array();    foreach($this -> getYears() as $currentYear)      foreach($this -> getMonthNames(SHORTHAND_MONTHS) as $month)        $bufferMonths[$currentYear][] = $month;    return $bufferMonths;  }  /**  *  * -------------- ****** The problem arises HERE ****** ---------------------  *  **/  function getDays()  {    $tempDate = null;    $bufferDays = array();    foreach($this -> getMonths() as $currentYear => $monthArray)    {      foreach($monthArray as $month)      {        $totalDays = date("t", mktime(0, 0, 0, $month, 1, $currentYear));        echo "M/D/Y = $month/1/$currentYear -- $totalDays days total..\r\n<br>";      }    }  }}