how to get the number of days of the current month? in PHP

Viewed 92301

i want to check if today is the last day of the month, but i don't really know how. i want to write it in php.

can you help?

thanks, Sebastian

11 Answers
$date = new DateTime('last day of this month');
$numDaysOfCurrentMonth = $date->format('d');

this is to find the days in any month:

$days = intval(date('t', strtotime($desiredDate)));
     echo date('t'); /// it return last date of current month
Related