Dunque, così funziona:
	Codice PHP:
	
$differenza = calcolaNotti('2016-05-30','2016-08-02');
var_dump($differenza);
function calcolaNotti($checkIn,$checkOut)
{
    // usare formato yyyy-mm-dd
    // la funzione restituisce un array('notti'=>'tot','mese'=>'notti','mese'=>'notti',........);
    // seconto quanti mesi vengono esaminati
    
    $mesi = ['01'=>'Gen','02'=>'Feb','03'=>'Mar','04'=>'Apr','05'=>'Mag','06'=>'Giu',
                '07'=>'Lug','08'=>'Ago','09'=>'Set','10'=>'Ott','11'=>'Nov','12'=>'Dic'];
    
    $giornoIn = substr($checkIn,8,2);
    $giornoOut = substr($checkOut,8,2);
    
    $meseIn = substr($checkIn,5,2);
    $meseOut = substr($checkOut,5,2);
    $annoIn = substr($checkIn,0,4);
    $result = [];
    // calcola la differenza totale
    $checkIn1 = date_create($checkIn);
    $checkOut1 = date_create($checkOut);
    $diff = date_diff($checkIn1, $checkOut1);
    $totNotti = $diff->format('%a');
    $result['notti'] = $totNotti;
    
    // funzione che calcola diff per mese
    function finemese($data)
    {
        $split = split('-', $data);
        $day = $split[2];
        $month = $split[1];
        $year = $split[0];
        
        $res = true;
        $count = 0;
        while($res)
        {
            $check = checkdate($month, $day, $year);
            if($check)
            {
                $day++;
                $count++;
                $res = true;
            }
            else{$res = false;}
        }
        
        return $count;
    }
    
    // restituisce i giorni per ogni mese
    $mOut = (int)$meseOut;
    $mIn = (int)$meseIn;
    $mesiToccati = $mOut - $mIn;
    if($mesiToccati > 1)
    {
        $giorno = $giornoIn;
        $start = (int)substr($checkIn,5,2);
        $end = (int)substr($checkOut,5,2);
        for($i=$start; $i<$end; $i++)
        {
            if($i<10){$ii = (string)'0'.$i;}
            else{$ii = (string)$i;}
            $nottiMese = finemese($annoIn.'-'.$ii.'-'.$giorno);
            $nomeMese = $mesi[$ii];
            $result[$nomeMese] = $nottiMese;
            $giorno = '01';
        }
        $nomeMeseOut = $mesi[$meseOut];
        $result[$nomeMeseOut] = ((int)$giornoOut) - 1;
    }
    else
    {
        $nottiMese1 = finemese($checkIn);
        $nomeMese1 = $mesi[$meseIn];
        
        $nottimese2 = $totNotti - $nottiMese1;
        $nomeMese2 = $mesi[$meseOut];
        
        $result[$nomeMese1] = $nottiMese1;
        $result[$nomeMese2] = $nottimese2;
    }
    
    return $result;
} 
 
passando come check-in 2016-05-30 e check-out 2016-08-02 ti restituisce un array così
array(5) {   ["notti"]=>   string(2) "64"   ["Mag"]=>   int(2)   ["Giu"]=>   int(30)   ["Lug"]=>   int(31)   ["Ago"]=>   int(1) }