title: Comparing Two dates only with month and year in PHP
body: <p>Let me explain the scenario. </p>
  
  <ol>
  <li><p>I have "Month(Any month from 01 TO 12)" and "Year(For Example 17 for 2017" in my local variables.</p></li>
  <li><p>I want to compare it with Current Month and Year.</p></li>
  </ol>
  
  <p>.</p>
  
  <pre><code>    $month = 04;
      $year = 17;
      if ($month.'-'.$year &gt; current month &amp; year)
      {
       echo "not expired";
      }
      else
      {
       echo "expired";
      }
  </code></pre>
  
  <p>3. For example:</p>
  
  <pre><code>$old_month = 03;  // March
  $old_year = 17;   // 2017
  
  $new_month = 05;  // May
  $new_year = 17;   // 2017
  //how to compare and determine which month&amp;year is old one or new one ?
  </code></pre>
  
  <p>Searched a lot in google and SO posts, but couldn't find any solution. Please help me.</p>
  
  <p>NB: I have only month and year in my hand to compare it with current month and year.</p>