- date: documentation ( source)
- strtotime: documentation ( source)
- range: documentation ( source)
- str_pad: documentation ( source)
<?php
$m = 1;
$y = 2016;
foreach (range(1, 31) as $day) {
if($day <= 9){
$day = '0'.$day;
}
// this is the important bit
$snap = strtotime("monday this week",strtotime("$m/$day/$y"));
echo str_pad('Snapping '.date('l',strtotime("$m/$day/$y")), 18, " ", STR_PAD_LEFT)," $m/$day/$y results: ",date('r',$snap),"\n";
}