I have a code that takes all dates on a certain day of the week.
Ex. 5/06/2017 = Monday.
The code is working perfectly. More is limited only 1 day of the week, I would like to "spend" more days an array.
function dias($dia_semana, $mes, $ano)
{
$date = new DateTime();
$dias = cal_days_in_month(CAL_GREGORIAN, $mes, $ano);
for ($dia = 0; $dia <= $dias; $dia++)
{
$date->setDate( $ano, $mes, $dia );
if ($date->format( "w" ) == $dia_semana)
{
$datas[] = $dia."/".$mes."/".$ano;
}
}
return $datas;
}
print_r(dias("1","06","2017");
// "1" = 0 = domingo até o 6 = Sábado
// "06" = mês
// "2017" = Ano
I wanted to pass array
instead of $dia_semana