Just slopped this together. Should work, but I haven't tested it. Returns in the YYYY-MM-DD format.
function workingdays($gap) {
if(is_numeric($gap)) { //needs to be a number
for($i=0;$i<=$gap;$i++) {
$newday = date("w",strtotime("+".$i." days")); // increment day of week
if($newday == 0 || $newday == 6) { // if sat. or sun.
$gap++; // increment gap
}
if($i == $gap) { // we've hit the number
return date("Y-m-d",strtotime("+".$gap." days"));
}
}
}
return false;
}
So today's Thursday, 2004-01-29, using
echo workingdays(4);
should return 2004-02-04.