xxxxxxxxxx
if(gmdate('t') == gmdate('d')){
echo 'Last day of the month.';
}
xxxxxxxxxx
$a_date = date("Y-m-d");
echo date("Y-m-t", strtotime($a_date));
xxxxxxxxxx
<?php
// Given a date in string format
$getDate = '2022-01-03';
// Converting string to date
$date = strtotime($getDate);
// Last date of current month.
$lastGetDate = strtotime(date("Y-m-t", $date ));
// Day of the last date
$day = date("l", $lastGetDate);
echo $day;
?>
//Output:
Monday