title: How to calculate number of days in each month in php
body: <p>need to calculate the number of days from current date to 27th of each month in PHP
  In below code, it's calculating correctly for current month but if the current date is 28th it should calculate for next month.</p>
  
  <pre><code>$year = date("y");
  $month = date("m");
  $day = '27';
  
  $current_date = new DateTime(date('Y-m-d'), new DateTimeZone('Asia/Dhaka'));
  $end_date = new DateTime("$year-$month-$day", new DateTimeZone('Asia/Dhaka'));
  $interval = $current_date-&gt;diff($end_date);
  echo $interval-&gt;format('%a day(s)');
  </code></pre>