I tried if condition if the date starts with 's' it's weekend but it's not working I don't know how to split date in to the day month and year.. Simply I need input two dates and get back array of workdays between that two dates.. No need to worry about holidays etc...
$begin = new DateTime('2020-10-29');
$end = new DateTime('2020-11-09');
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);
foreach ($period as $dt) {
if(strpos($dt, 's') === 0) {
echo "not workday";
}
else{
echo $dt->format("l Y-m-d\n");
}
}