since strtotime lasts until the next month, if there are no days in that month, you can go back for 6 months and check if it ends at the start date.
$date2 = date("Y-m-d", strtotime("{$date} +6 months"));
$date3 = date("Y-m-d", strtotime("{$date2} -6 months"));
if($date3 != $date)
{
$date2 = date("Y-m-t", strtotime("{$date2} -1 months"));
}
( "m/t/Y" )