function getNumberOFDays($from,$to){
    $from_date = new DateTime($from);
    $to_date = new DateTime($to);
    
    return $from_date->diff($to_date)->days;
    //return $from_date->diff($to_date)->h;
    //return $from_date->diff($to_date)->i;
    //return $from_date->diff($to_date)->s;
    //return $from_date->diff($to_date)->invert;
    //return $from_date->diff($to_date)->d;
    //return $from_date->diff($to_date)->m;
    //return $from_date->diff($to_date)->y;
    //DateInterval Object ( [y] => 0 [m] => 0 [d] => 26 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 26 ) 
}

Örnek Kullanım:

echo getNumberOFDays('2014-07-16','2014-08-11');