You can use Dateperiod class to assemble the desired time period, in the example I used the month of February, to know which days are weekends (Saturday and Sunday) the English one helps, because both days begin with S(Saturday and Sunday), just know if the weekday starts with S or not.
$inicio = new DateTime('2016-02-01');
$fim = new DateTime('2016-02-29');
$periodo = new DatePeriod($inicio, new DateInterval('P1D'), $fim);
$validos = [];
foreach($periodo as $item){
if(substr($item->format("D"), 0, 1) != 'S'){
$validos[] = $item->format('d/m/Y');
}
}
echo "<pre>";
print_r($validos);
Satida:
Array
(
[0] => 01/02/2016
[1] => 02/02/2016
[2] => 03/02/2016
[3] => 04/02/2016
[4] => 05/02/2016
[5] => 08/02/2016
[6] => 09/02/2016
[7] => 10/02/2016
[8] => 11/02/2016
[9] => 12/02/2016
[10] => 15/02/2016
[11] => 16/02/2016
[12] => 17/02/2016
[13] => 18/02/2016
[14] => 19/02/2016
[15] => 22/02/2016
[16] => 23/02/2016
[17] => 24/02/2016
[18] => 25/02/2016
[19] => 26/02/2016
)
Downvoter, what can be done to improve the question?
– Wallace Maxters