Tell me please how to get the last number of weeks in a year?
Tell me please how to get the last number of weeks in a year?
With strtotime() you can count till 2037 cause the 2038 bug
To be sure to count all weeks of a year you must count from the 28th December, because is the only day surely in the last week of the year.
<?php
for($year=2018;$year<2038;$year++) {
echo $year.' => ' .date("W",strtotime('28th December '.$year)) .' Weeks<br>';
}
?>
Result: