As a programmer you might wish that every month had the same length, but things aren't that simple. Let's see what we can do in MySQL to find out the last day of the month and the number of days in a month.
Fairly simple, but maybe not always that obvious,
last_day returns the date of the last day in the month and
day returns the day portion from it.
SELECT last_day(now()) as last_day, day(last_day(now())) as days_per_month