I'm not sure if this is possible.
I have an IF statement that I am hoping to add a counter to.
Here is my IF statement:
if ($ageOnDec2016->format('%y') > 12)
{
$ageOnDec2016Display = "<span style='background-color: #FFE4E1'>Aged Out</span>";
} elseif ($ageOnDec2016->format('%y') == 12)
{
$ageOnDec2016Display= "<span style='background-color: #98FB98'>".$ageOnDec2016->format('%y') ."</span>";
}
elseif ($ageOnDec2016->format('%y') == 5)
{
$ageOnDec2016Display= "<span style='background-color: #98FB98'>K Start</span>";
}
else
{
$ageOnDec2016Display= $ageOnDec2016->format('%y');
}
What I am wanting to do is add a counter in the IF statement. If I understand counters correctly, I need to initialize the counter outside the IF Statement, as such:
$KStart2016=0;
Then, I need to add the counter++ in my if statement. So, like this:
elseif ($ageOnDec2016->format('%y') == 5)
{
$ageOnDec2016Display= "<span style='background-color: #98FB98'>K Start</span>";
$KStart2016++;
}
Unfortunately, the code is not picking up the counter. It only displays the "0" that I have the counter initialized with.
Any suggestions?