$days = cal_days_in_month(CAL_GREGORIAN, 4, 2013);
echo "Number of days in April 2013 = $days";
The output is here
Number of days in April 2013 = 30
Syntax is here:
cal_days_in_month(type of calendar, month, year )
echo date('t');
The output is here
30$m= date('m');// Present Month
$y= date('Y'); // Preseent year
$no_of_days = date('t',mktime(0,0,0,$m+1,1,$y));
// This is to calculate number of days in next month
echo " Number of days in Next to $m month :$no_of_days";
The output is here Number of days in Next to 09 month : 31$no_of_days = date('t',mktime(0,0,0,$m-1,1,$y));
// to calculate number of days in previous month
strtotime: to get Date formats from a string input
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.