1function sumDays($days = 0, $format = 'd/m/Y') {
2 $incrementing = $days > 0;
3 $days = abs($days);
4 $actualDate = date('Y-m-d');
5
6 while ($days > 0) {
7 $tsDate = strtotime($actualDate . ' ' . ($incrementing ? '+' : '-') . ' 1 days');
8 $actualDate = date('Y-m-d', $tsDate);
9
10 if (date('N', $tsDate) < 6) {
11 $days--;
12 }
13 }
14
15 return date($format, strtotime($actualDate));
16}
17