$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
31
$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 10 month : 30$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
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.