Question: I am displaying month titles 3 month into the future as well as getting the 1st and last day of each of those months.

```
for($i = 1; $i < 4; $i++) { // For each month for 3 months
    $monthTitle = date('F Y', strtotime('+'.$i.' month'));
    $begin_date = date('Y-m-01', strtotime('+'.$i.' month')); // First day of calendar month in future.
    $end_date = date('Y-m-t', strtotime('+'.$i.' month')); // Last day of calendar months in future.
};

```

Nov. 29, 2015 output is:

```
December 2015
2015-12-01
2015-12-31
January 2016
2016-01-01
2016-01-31
February 2016
2016-02-01 
2016-02-29

```

This was working great right up until yesterday, Nov. 29, 2015 but today Nov. 30, 2015 it skips February. 

Nov. 30, 2015 output is:

```
December 2015
2015-12-01
2015-12-31
January 2016
2016-01-01
2016-01-31
March 2016
2016-03-01 
2016-03-31

```

I'm guessing a bug but **does anybody know of a work around?**

Answer: 
Thanks to @devlin carnate for pointing me in the right direction.

```
for($i = 1; $i < 4; $i++) { # for each month
    $tmp = date('Y-m-15'); // Get the middle of the month to avoid PHP date bug.
    $begin_date = date('Y-m-01', strtotime($tmp . '+'.$i.' month')); // First day of calendar month in future.
    $end_date = date('Y-m-t', strtotime($begin_date)); // Last day of calendar months in future.
    $monthTitle = date('F Y', strtotime($begin_date));
};

```

This seems to work very well.
if last day of next month is needed then you can use this

```
$d = new DateTime( '2010-01-31' );
$d->modify( 'last day of next month' );
echo $d->format( 'Y-m-d' ), "\n";

```