title: php get last day of given month
body: <p>I want to output of last and first date of a given month of current year. I am using this code but not works</p>
  
  <pre><code>$month='02';
  $first_day_this_month = date('Y-'.$month.'-01'); // hard-coded '01' for first day
  $last_day_this_month  = date('Y-'.$month.'-t');
  
  echo $first_day_this_month;print'&lt;-&gt;';echo $last_day_this_month;
  </code></pre>
  
  <p>my output shows</p>
  
  <pre><code>2015-02-01&lt;-&gt;2015-02-31
  </code></pre>
  
  <p>But it will be <code>2015-02-01&lt;-&gt;2015-02-28</code></p>