title: How to Build a Counter in an IF statement
body: <p>I'm not sure if this is possible.</p>
  
  <p>I have an IF statement that I am hoping to add a counter to.</p>
  
  <p>Here is my IF statement:</p>
  
  <pre><code>        if ($ageOnDec2016-&gt;format('%y') &gt; 12)
          {   
              $ageOnDec2016Display = "&lt;span style='background-color: #FFE4E1'&gt;Aged Out&lt;/span&gt;";
  
          } elseif ($ageOnDec2016-&gt;format('%y') == 12) 
          {
              $ageOnDec2016Display= "&lt;span style='background-color: #98FB98'&gt;".$ageOnDec2016-&gt;format('%y') ."&lt;/span&gt;";
          }
          elseif ($ageOnDec2016-&gt;format('%y') == 5) 
          {
              $ageOnDec2016Display= "&lt;span style='background-color: #98FB98'&gt;K Start&lt;/span&gt;";
          }
          else
          {               
              $ageOnDec2016Display= $ageOnDec2016-&gt;format('%y');
          }
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>     $KStart2016=0;
  </code></pre>
  
  <p>Then, I need to add the counter++ in my if statement.  So, like this:</p>
  
  <pre><code>     elseif ($ageOnDec2016-&gt;format('%y') == 5) 
          {
              $ageOnDec2016Display= "&lt;span style='background-color: #98FB98'&gt;K Start&lt;/span&gt;";
              $KStart2016++;
          } 
  </code></pre>
  
  <p>Unfortunately, the code is not picking up the counter.  It only displays the "0" that I have the counter initialized with.</p>
  
  <p>Any suggestions?</p>