title: PHP: date functions' results related to NEXT month are not correct (PHP bugs or sg. else?)
body: <p>I tried some date functions, because I would like to get some dates of the <strong>next month</strong> with PHP, but I experienced some problems.  </p>
  
  <p>The current date as a MySQL-compatible timestamp (<code>date('Y-m-d H:i:s');</code>) is the following:<br>
  <code>'2012-05-31 14:59:19'</code></p>
  
  <ul>
  <li><code>date('t', strtotime('next month'));</code> which gives the <strong>number of days in the next month</strong>, returns <strong>31</strong> as a result... which is not correct, because <strong>June consists of only 30 days</strong> (seems like it outputs the days of July).</li>
  <li><code>date('Y-m-d H:i:s', strtotime('next month'));</code>, which gives the <strong>next month's timestamp format</strong>, returns <code>'2012-07-01 14:59:19'</code>, but I would expect the following:<br>
  <code>'2012-06-30 14:59:19'</code>.</li>
  </ul>
  
  <p>So I tried some codes, here are my experiments, using <a href="http://hu.php.net/manual/en/function.date.php" rel="nofollow noreferrer" title="date&#40;&#41;"><code>date()</code></a>, <a href="http://php.net/manual/en/function.strtotime.php" rel="nofollow noreferrer" title="strtotime&#40;&#41;"><code>strtotime()</code></a> and <a href="http://php.net/manual/en/class.datetime.php" rel="nofollow noreferrer" title="DateTime"><code>DateTime class</code></a>: <a href="http://pastebin.com/3iaH4iSZ" rel="nofollow noreferrer">http://pastebin.com/3iaH4iSZ</a></p>
  
  <p>And the OUTPUT looks like the following (<a href="http://pastebin.com/tAM9zxrD" rel="nofollow noreferrer">you can also see it here!</a>):
  <a href="https://i.stack.imgur.com/mHHRu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mHHRu.png" alt="PHP date functions related to NEXT month"></a></p>
  
  <p>Are these PHP bugs, or do I misunderstand something?</p>
  
  <hr>
  
  <p>I would expect the same results as when using MySQL's date functions, just a few examples:</p>
  
  <pre><code>SELECT NOW( )
  </code></pre>
  
  <p>2012-05-31 17:51:15</p>
  
  <pre><code>SELECT DATE_ADD(NOW(), INTERVAL 1 MONTH)
  </code></pre>
  
  <p>2012-06-30 17:51:15</p>
  
  <pre><code>SELECT DATE_ADD( '2013-01-30 17:51:15', INTERVAL 1 MONTH )
  </code></pre>
  
  <p>2013-02-28 17:51:15</p>
  
  <pre><code>SELECT DATE_ADD( '2013-01-31 17:51:15', INTERVAL 1 MONTH )
  </code></pre>
  
  <p>2013-02-28 17:51:15</p>