Is this an efficient way to do this?
the code is designed to find the nearest friday, without passing Sunday. If it is already past Friday, the start date should equal now.
function get_weekend(){
$start = time();
$day = date('w',$now);
//find friday, without going past Sunday
while ($day < 5 && $day > 0){
$start = $start + 86400;
$day = date('w',$start);
}
//find nearest sunday to start date
$end = $start;
while ($day != 0){
$end = $end + 86400;
$day = date('w',$end);
}
$weekend['StartDate']=date("d-F-Y",$start);
$weekend['EndDate'] = date("d-F-Y",$end);
return $weekend;
}