Get specific day's date based on the week number and the year

     

I'm getting the year and the 'week-of-the-year' from the external source which I'm not able to change. I'd like to get the date of Monday and Sunday of that concrete week. For now I've got the below code but it seems pretty complicated.


// simulate the server data  $year = date('Y');  $week = 19;
$weekNow = (int) date('W');  $weekDiff = $week - $weekNow; // can be positive or negative  $daysDiff = $weekDiff * 30;
$dayInDesiredWeek = (int) date('N'