<?php
/*
the difference in days between today and '$delay' number
business days (M-F). yes.
*/
function g($current_day, $delay)
{
/*
wraps around to the next day which is
'$delay' number of business days from today
lol, math
*/
if(($current_day+$delay) > 5)
return abs((7+(((min($current_day, 5)+($delay-1))%5)+1)) - $current_day);
else
return $delay;
}
function f($current_day, $delay)
{
return abs((7+(((min($current_day, 5)+($delay-1))%5)+1)) - $current_day);
}
for($i = 1; $i < 8; $i++)
printf("\tf(%d, 1) => %d\n", $i, f($i, 1));
printf("\n\n\n\n");
for($i = 1; $i < 8; $i++)
printf("\tf(%d, 2) => %d\n", $i, f($i, 2));