How to exclude previous months of the current month?
<p>I have the following PHP that displays the month then an IF statement inside the foreach that says IF the month is February then do the <code>li</code>:</p>

<pre><code>$months = array('1' =&gt; 'January', '2' =&gt; 'February', '3' =&gt; 'March', '4' =&gt; 'April', '5' =&gt; 'May', '6' =&gt; 'June', '7' =&gt; 'July', '8' =&gt; 'August', '9' =&gt; 'September', '10' =&gt; 'October', '11' =&gt; 'November', '12' =&gt; 'December');
echo '&lt;li&gt;&lt;a class="by_month"&gt;&lt;/a&gt;&lt;ul class="monthby" name="monthby"&gt;';
foreach($months as $month =&gt; $monthtitle):
  if ($month == '2'){
     echo '&lt;li title="'.$monthtitle.'" rel="'.$month.'"&gt;&lt;a href="#" title="'.$monthtitle.'"&gt;'.$monthtitle.'&lt;/a&gt;&lt;/li&gt;';
  }
endforeach;
echo '&lt;/ul&gt;&lt;/li&gt;';
</code></pre>

<p>How do I modify the above code to say IF the month is February, then exclude any previous months. Basically, I want to create a list of the current month and upcoming months but exclude past months of the year.</p>

<p>So, for example, if the month was November, the list would ONLY show November and December. It would exclude all previous months.</p>

<p>How can I do this? I image I need to do something with an IF statement, like I sort of started but using <code>date('n')</code> to get the current month then ignore previous months of the current month.</p>

<p>Any help?</p>
