With this code i want to list all weekdays between $startdate and $enddate.
Example:
If startdate is a Monday and enddate is a Tuesday i want it to list all Mondays between the days. And that works OK with the script.
But if startdate is a Monday and enddate is a Monday too it doesn't list the last Monday who is the enddate.
What should i change in the code to get it to include the enddate Monday too?
function get_days ( $s, $e )
{
$r = array ();
$s = strtotime ( $s );
$e = strtotime ( $e );
$day = date ( 'l', $s );
do
{
$r[] = $day . ', ' . date ( 'Y-m-d', $s );
$s += 86400 * 7;
} while ( $s <= $e );
foreach ($r as $varde) {
echo "<input type=\"checkbox\" name=\"C1\" value=\"$varde\" checked> $varde<br>\n";
}
}
get_days ( "$startdate", "$enddate" );