I have a function that compares two dates. Based on the number of days between the two dates, a status var is set. Here is the code:
switch (TRUE) {
case ($Days>14):
$Result = $PRIORITY_COLOR['visible'];
break;
case ($Days>=8 && $Days<=14):
$Result = $PRIORITY_COLOR['notice'];
break;
case ($Days>=4 && $Days<=7):
$Result = $PRIORITY_COLOR['current'];
break;
case ($Days>=1 && $Days<=3):
$Result = $PRIORITY_COLOR['important'];
break;
case ($Days=0):
$Result = $PRIORITY_COLOR['urgent'];
break;
case ($Days=-1):
$Result = $PRIORITY_COLOR['critical'];
break;
case ($Days<-1):
$Result = $PRIORITY_COLOR['emergency'];
break;
}
return $Result;
It all seems to work fine, except when the variable 'Days' equals -14. Instead of hitting the last case section (<-1), it hits the one before it (=-1). I thought it could be treating the value as a string so I tested for is_numeric and it's coming back numeric. I've done some echos and verified the value is -14.
Any ideas on what I am doing wrong?