$timestamp = strtotime($end_date) - strtotime($start_date);
$days = round($timestamp / 86400);

this code only works on linux box.