I want to get all the working days of current week by ignoring weekends (Saturday and Sunday) also I want to ignore holidays as well (holiday list are in database)
Here is my code to get all the working days of current weeks (excluding Saturday and Sunday)
$holiday_date_list = []; // from database
$dt = new DateTime();
$dates = [];
for ($d = 1; $d <= 5; $d++)
{
$dt->setISODate($dt->format('o'), $dt->format('W'), $d);
$dates[$dt->format('D')] = $dt->format('Y-m-d');
}
foreach ($dates as $key => $value)
{
echo $value . "<br>";
}
How can exclude holiday list from the above script?