<?php
function calcularPrazo($prazoPrevio){
$dataSTR = date('d-m-Y'); //hoje
//time do dia que sera o dia final do prazo previo
$time = mktime(0, 0, 0, $data[1], intval($data[0]) + $prazoPrevio, $data[2]);
$diaSemana = date("w", $time);
switch($diaSemana){
case 0: //domingo
//subtrair mais dois dias
$prazoPrevio -= 2;
break;
case 6: //sabado
//subtrair mais um dias
$prazoPrevio -= 1;
break;
}
$time = mktime(0, 0, 0, $data[1], intval($data[0]) + $prazoPrevio, $data[2]); return date('d-m-Y',$time); }
echo calcularPrazo(11);
PD9waHAKCmZ1bmN0aW9uIGNhbGN1bGFyUHJhem8oJHByYXpvUHJldmlvKXsKCSRkYXRhU1RSID0gZGF0ZSgnZC1tLVknKTsgLy9ob2plCgkKCSRkYXRhID0gZXhwbG9kZSgnLScsJGRhdGFTVFIpOwoJCgkvL3RpbWUgZG8gZGlhIHF1ZSBzZXJhIG8gZGlhIGZpbmFsIGRvIHByYXpvIHByZXZpbwoJJHRpbWUgPSBta3RpbWUoMCwgMCwgMCwgJGRhdGFbMV0sIGludHZhbCgkZGF0YVswXSkgKyAkcHJhem9QcmV2aW8sICRkYXRhWzJdKTsKCQoJJGRpYVNlbWFuYSA9IGRhdGUoInciLCAkdGltZSk7CgoJc3dpdGNoKCRkaWFTZW1hbmEpewoJCWNhc2UgMDogLy9kb21pbmdvCgkJCS8vc3VidHJhaXIgbWFpcyBkb2lzIGRpYXMKCQkJJHByYXpvUHJldmlvIC09IDI7CgkJCWJyZWFrOwoJCWNhc2UgNjogLy9zYWJhZG8KCQkJLy9zdWJ0cmFpciBtYWlzIHVtIGRpYXMKCQkJJHByYXpvUHJldmlvIC09IDE7CgkJCWJyZWFrOwoJfQoJCgkkdGltZSA9IG1rdGltZSgwLCAwLCAwLCAkZGF0YVsxXSwgaW50dmFsKCRkYXRhWzBdKSArICRwcmF6b1ByZXZpbywgJGRhdGFbMl0pOwoJcmV0dXJuIGRhdGUoJ2QtbS1ZJywkdGltZSk7Cn0KCgoKZWNobyBjYWxjdWxhclByYXpvKDExKTs=