Try this, enter a date between two dates without weekdays (Saturday and Sunday).
$ startdate = '10 -06-2015 ';
$ endDate = '17 -06-2015 ';
$ Workingdays = getdateBettwoDate ($ startdate, $ endDate);
print_r ($ Workers);
function getdateBettwoDate ($ startdate, $ enddate) {
$start = new DateTime($startdate); $end = new DateTime($enddate); $interval = DateInterval::createFromDateString('1 day'); $period = new DatePeriod($start, $interval, $end); $x=0; $a=array(); foreach ($period as $dt) { $temp=$dt->format("l dmY"); $ArTemp=explode(' ',$temp); if($ArTemp[0]=='Saturday' || $ArTemp[0]=='Sunday'){ }else{ $a[$x]=$ArTemp[1]; $x++ ; } } $a[$x]=date('l', strtotime( $enddate))." ".$enddate; return $a ; }
source share