People need to know how to calculate how many weeks there are in a given month with PHP.
What is the best way to do this?
People need to know how to calculate how many weeks there are in a given month with PHP.
What is the best way to do this?
An example on soen
$mes = 2;
$ano = 2016;
$days = cal_days_in_month(CAL_GREGORIAN, $mes, $ano);
$week_day = date("N", mktime(0,0,0,1, $mes, $ano));
$weeks = ceil(($days + $week_day) / 7);
echo $weeks;