Prova cosi':

Codice PHP:
function days_in_month($month$year) {
    
$start date('Y-m-d'mktime(000$month1$year));
    
$end   date('Y-m-t'strtotime($start));

    
$current $start;
    
$days = array();

    while (
$current <= $end) {
        
$weekday date('D'strtotime($current));
        if (!isset(
$days[$weekday])) {
            
$days[$weekday] = 0;
        }

        
$days[$weekday]++;

        
$current date('Y-m-d'strtotime("{$current} +1 day"));
    }

    return 
$days;
}

$days days_in_month(42015);
print_r($days); 
output:
codice:
Array
(
    [Wed] => 5
    [Thu] => 5
    [Fri] => 4
    [Sat] => 4
    [Sun] => 4
    [Mon] => 4
    [Tue] => 4
)