Grazie!
Ho risolto con
codice:
if ($a % 4 == 0 && ($a % 100 != 0 || $a % 400 == 0)) {
	$ngiorni = 30;
} else {
	$ngiorni = 29;
};