Efficiently working out the nearest weekend 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 &lt; 5 &amp;&amp; $day &gt; 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;

    }
Short, short version:

function get_weekend()
{
    $fri = strtotime('friday');
    $sun = strtotime('sunday');
    // strtotime('friday') will be after strtotime('sunday') if it is after 0:00 Friday
    // and before 0:00 on Sunday
    $start = $sun &lt; $fri? now():$fri;
    $weekend = array();
    $weekend['StartDate'] = date('d-F-Y', $start);
    $weekend['EndDate'] = date('d-F-Y', $end);
    return $weekend;
}