- abs: documentation ( source)
- ceil: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
function get_weekday($date) {
$week_day = date('w',$date);
if ($week_day == 0)
return strtotime("+1 day",$date);
elseif ($week_day == 6)
return strtotime("+2 day", $date);
return $date;
}
for($i = 1; $i < 10; $i++)
{
$today = strtotime("+$i days");
$quote_for = get_weekday($today);
$diff = ceil(($quote_for - $today)/86400); // difference in days
echo "On " . date('l \t\h\e jS',$today) .
" the shipping quote will be for " . date('l \t\h\e jS', $quote_for) .
" which is " . abs($diff) . " days " . ($diff <0?"before":"after") . " today. " .
date('Y-m-d',$today) . " - " . date('Y-m-d',$quote_for) . "\n";
}