title: Elegant way to get the count of months between two dates?
body: <p>Let's assume I have two dates in variables, like</p>
  <pre><code>$date1 = &quot;2009-09-01&quot;;
  $date2 = &quot;2010-05-01&quot;;
  </code></pre>
  <p>I need to get the count of months between <code>$date2</code> and <code>$date1</code>(<code>$date2 &gt;= $date1</code>). I.e. i need to get <code>8</code>.</p>
  <p>Is there a way to get it by using <a href="http://php.net/manual/en/function.date.php" rel="nofollow noreferrer">date</a> function, or I have to explode my strings and do required calculations?</p>
  <p>Thanks.</p>