Haven't tested this yet, but it should work...
$today = mktime(); //get timestamp of today
$month = date("m"); //current numberic month
$year = date("Y"); //current numeric year
$nextMonth = ($month + 1); //numeric next month
// calculate if next month is January
//and add year, set month to 1
if($nextMonth == 13) {
$year = ($year+1);
$nextMonth = 1;
}
// get timestamp for the first of next month
$var = mktime(0,0,0,$nextMonth,1,$year);
//get difference in timestamp,
//divide by days(86400 seconds)
//and format it to a whole number
$diff = number_format(($var-$today)/86400);
echo $diff." days until next month";