How to get months name and month days between two differente dates?

Please try it.

$start_date  = '2015-11-15';
$end_date  = '2015-12-25';
$result = array();
$start_time   = strtotime($start_date);
$end_time   = date('m-Y', strtotime($end_date));

do {
    $month_year = date('m-Y', $start_time);
    $days = date('t', $start_time);

    $result[] = [
        'month_year' => $month_year,
        'days' => $days,

    $start_time = strtotime('+1 month', $start_time);
} while ($month_year != $end_time);
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.