PHP: How to get Sunday and Saturday

<?phpfunction getSaturdays($year,$month){$last_day = date('t',strtotime($year.'-'.$month));for ($x = 1; $x <= $last_day; $x++) {$d1 = strtotime($year.'-'.$month.'-'.$x);if(date('D', $d1)==Sat){//all Saturdays$sat = strtotime(date('Y-m-d H:i:s', $d1).'+12 hours'); //Saturday$mon = strtotime(date('Y-m-d H:i:s', $sat).'+42 hours'); //Monday$out[]=array(date('Y-m-d H:i:s',$sat), date('Y-m-d H:i:s',$mon));}}return $out;}

$days = getSaturdays(2016,9);
echo <pre>;print_r($days);echo </pre>;?>