- var_dump: documentation ( source)
<?php
$startOfWeek = '16-07-2017';
$endOfWeek = new DateTime($startOfWeek);
echo $endOfWeek->format('d-m-Y') . "\n";
$endOfWeek->modify('+5 day');
echo $endOfWeek->format('d-m-Y') . "\n";
$endOfWeekString = $endOfWeek->format('d-m-Y');
function firstDayOfWeek($date)
{
$day = DateTime::createFromFormat('d-m-Y', $date);
$day->setISODate((int)$day->format('o'), (int)$day->format('W'), 1);
return $day->format('d-m-Y');
}
var_dump(firstDayOfWeek($startOfWeek));
echo $endOfWeekString;