The first ISO week of the year is the one with the first Thursday of the year in it. So let's see what day of the week January 1 of the $year was.
$Jan1 = mktime(1,1,1,1,1,$year);
$weekdayJan1 = date('w',$Jan1);
The exact time doesn't really matter - I just felt like specifying 01:01:01.
Thursday is day number 4. So if January 1 was day $weekdayJan1, then the Thursday of the first week would be color=darkblue%7[/color] days later (with the extra 7s there in case Jan 1 actually belonged to the last week of the previous year), and that first week started on the previous Monday (three days earlier than the Thursday, i.e., color=darkblue%7-3[/color] days after Jan 1).
A table that illustrates that expression:
$weekdayJan1: | Monday of first week of year is...
| (11-$weekdayJan1)%7-3
--------------+-----------------------------------
Monday | 0 days later (Jan 1)
Tuesday | -1 days later (Dec 31)
Wednesday | -2 days later (Dec 30)
Thursday | -3 days later (Dec 29)
Friday | 3 days later (Jan 4)
Saturday | 2 days later (Jan 3)
Sunday | 1 days later (Jan 2).
And code that uses it to get a timestamp for the Monday of the first week of the year:
$FirstMonday = strtotime(((11-$weekdayJan1)%7-3) . ' days', $Jan1);
Of course the first Monday of the current $week is $week-1 weeks later than that:
$CurrentMonday = strtotime(($week-1) . ' weeks', $FirstMonday);
$FirstMonday can be dropped and $CurrentMonday found with a single call strtotime(), passing it a string of the form "n weeks m days"; so an entire WeekToDate($week,$year) function can be written in three or four lines, viz:
// Added _much_ later....
function StartOfWeek($year, $week)
{
$Jan1 = mktime(1,1,1,1,1,$year);
$MondayOffset = (11-date('w',$Jan1))%7-3;
$desiredMonday = strtotime(($week-1) . ' weeks '.$MondayOffset.' days', $Jan1);
return $desiredMonday;
}
Tuesday, of course, is one day later, Wednesday is two days later, and so on. Sunday (according to ISO) is six days later, but you may reckon it's one day earlier. No, it doesn't format the result into any particular form. This function is not the place to be doing that sort of thing.