If you ever need to find the last day of the month in php this is how to do it.
You convert to seconds the current year and month and then let date() function to find what's the last day of that selected month.
<?php
$year = 2024;
$month = 2;
$last_day_of_month = date('Y-m-t', strtotime($year . '-' . $month));
Finding the last day can be useful if you want to run some SQL queries or other data that needs a start and an end day.
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer