I'm currently storing the dates in an imploded array of date stamps created using mktime(0,0,0,$month,1,date('Y')) - I was planning on just comparing the date stamps to whatever the date stamp for the invoice was. Then, it occurred to me that any time the year changes those date stamps will be obsolete. Should I just store their bill cycle months as month names and compare the strings with in_array()?
Code: Select all
$billcycle = array('January','April','July','October');
$invoicedate = mktime(0,0,0,1,1,date('Y')); // Invoice Date: January 1 of this year
$comparedate = date('F',$invoicedate); // Get just the month(January) from $invoicedate
if(in_array($comparedate,$billcycle)) {
// perform conditional formatting
} else {
// don't
}
Is there a better way to do this? Seems kludgy. Thanks in advance for your input!