title: Set day with no overflow (with PHP Carbon)
body: <p>I use Carbon (PHP library) to set day to a date. But I want it not going to the next month, but rather stop and the end of month.
  Example:</p>
  
  <pre><code>Carbon::create(2018, 2, 27, 0, 0, 0)-&gt;day(31);
  </code></pre>
  
  <p>I'm getting </p>
  
  <blockquote>
    <p>2018-03-03 00:00:00</p>
  </blockquote>
  
  <p>But I need </p>
  
  <blockquote>
    <p>2018-02-28 00:00:00</p>
  </blockquote>
  
  <p>When you operate months Carbon gives you <code>-&gt;subMonthsNoOverflow()</code> and -<code>&gt;addMonthsNoOverflow()</code> which is really helpful but there is nothing like this for setting a day.</p>