Here is a complete function:
public function get_number_of_days_in_month($month, $year) {
// Using first day of the month, it doesn't really matter
$date = $year."-".$month."-1";
return date("t", strtotime($date));
}
This would output following:
echo get_number_of_days_in_month(2,2014);
Output: 28