This will do what you need, though you might want to tweak it to fit your project.
<?php
$date="01-Aug-2018";
$date2 = '07-Aug-2018';
$period = new DatePeriod(
new DateTime($date),
new DateInterval('P1D'),
new DateTime($date2)
);
$weekends = [];
foreach ($period as $key => $value) {
if ($value->format('N') >= 6) {
$weekends[$value->format('d-m-Y')] = $value->format('D');
}
}
var_dump($weekends);
1
solved Get Weekends between two dates if present in php [duplicate]