3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $year = '2015'; $week = '01'; $month = date('m', strtotime($year . 'W' . $week)); $weeks = [ '0' => ((int)$week == 1) ? date('W', strtotime('December 28th,' . $year - 1)) : (int)$week - 1, '1' => $week, '2' => (date('W', strtotime('December 28th,' . $year)) == $week) ? '01' : (int)$week + 1, '3' => (date('W', strtotime('December 28th,' . $year)) == $week) ? '01' : (int)$week + 2, '4' => (date('W', strtotime('December 28th,' . $year)) == $week) ? '01' : (int)$week + 3, '5' => (date('W', strtotime('December 28th,' . $year)) == $week) ? '01' : (int)$week + 4 ]; print_r(date('W', strtotime('December 28th,' . $year)));
based on POocm
Output for 7.1.0 - 7.2.0
Warning: A non-numeric value encountered in /in/Wj2hX on line 7 53
Output for 5.4.0 - 7.0.20
53