- range: documentation ( source)
- printf: documentation ( source)
<?php
foreach(range(0, 7) as $no) {
$date1 = new DateTime('2014-01-01');
$date2 = new DateTime("today +{$no} week");
printf("Woche %d: %d\n", $no, $date1->diff($date2)->days / 7 % 3+1);
}