- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$test = date('l');
$test = 'sd';
if($test = "Sunday"){
$end = date('Y-m-d',strtotime('Sunday last week'));
$start = date('Y-m-d',strtotime('Monday last week'));
}else{
$end = date('Y-m-d',strtotime('Sunday this week'));
$start = date('Y-m-d',strtotime('Monday this week'));
}
echo $start;
echo $end;