title: Getting The End Date of the Given Month
body: <p>I need to get the end date of the given month for some calculation purpose,</p>
  
  <p>how can I do that in PHP, I tried using date() function, but It didn't work.</p>
  
  <p>I used this:</p>
  
  <pre><code>date($year.'-'.$month.'-t');
  </code></pre>
  
  <p>But this gives the current month's end date.
  I think I'm wrong somewhere, I couldn't find where I'm going wrong here.</p>
  
  <p>If I give year as 2012 &amp; month as 03, then it must show me as 2012-03-31.</p>