php compare two dates, month and year only
<p>I want to compare two dates -- just the month and the year -- to see if one falls before the other. This is what I have currently:</p>

<pre><code>$monthyear = date("M Y"); 
$finish = date("M Y",strtotime($row-&gt;finish));
$start = date("M Y",strtotime($row-&gt;start));
if ($start &lt;= $monthyear and $finish &gt;= $monthyear) {
   do some stuff..
}
</code></pre>

<p>What I'm trying to do, in plain English: If the start date is before or during the current month, and the finish date is after or during the current month, then do some stuff.</p>

<p>However, what is happening is that it is, e.g., October 2015 is seen as falling AFTER May 2016 (i.e., it runs what's inside the brackets if the finish date is October 2015). From what I can tell, it is comparing the months only, rather than the month + the year.</p>

<p>Any idea how to do make these comparisons correctly?</p>