PHP 获得本年每月的第 N 个星期 N

1
2
3
4
5
6
7
$year = date('Y');
$months = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec');
$datearr = array();
foreach ($months as $key => $month) {
array_push($datearr, date('Y-m-d', strtotime("second monday of {$month} {$year}")));
}
var_dump($datearr);