- var_dump: documentation ( source)
<?php
function daysInWeek($weekNum)
{
$result = array();
$datetime = new DateTime('00:00:00');
$datetime->setISODate((int)$datetime->format('o'), $weekNum, 1);
$interval = new DateInterval('P1D');
$week = new DatePeriod($datetime, $interval, 6);
foreach($week as $day){
$result[] = $day->format('D d m Y H:i:s');
}
return $result;
}
var_dump(daysInWeek(24));
//and the difficult ones:-
var_dump(daysInWeek(1));
var_dump(daysInWeek(53));