Get the day is the week of the month, and learn about the confusing strtotime

Strtotime (” $firstDay + 1 month -1 day “) is not a good way to write it

Confusing strtotime

<? Public function getWeek() public function getWeek() public function getWeek() int { $todayW = date('W', strtotime('now')); $eomW = date('W', strtotime("$firstDay + 1 month -1 day")); $eomW = date('W', strtotime('last day of')); $weekSum = Floor (date('t') / 7); $week = intval(($weekSum - ($eomW - $todayW)) + 1); return $week; }