Oto kod funkcji.
function kalendarz ($month,$year)
{
$start= mktime(0,0,0,$month,1,$year);
$firstdayarray = getdate($start);
$start2= mktime(0,0,0,$month,1,$year);
$firstdayarray2 = getdate($start2);
$months = Array('Styczen','Luty','Marzec','Kwiecien','Maj','Czerwiec','Lipiec','Sierpien','Wrzesien','Pazdziernik','Listopad','Grudzien');
$days = Array('Pn','Wt','Sr','Cz','Pt','Sb','Nd');
echo '<center><b>'.$months[($month)-1].'</b></center>';
echo '<table border=1 align="center"><tr>';
for ($i=0; $i<7; ++$i)
{
echo '<td><b>'.$days[$i].'</b></td>';
}
echo '</tr>';
$d=0;
for ($j=0; $j<6; ++$j)
{
echo '<tr>';
for ($i=1; $i<8; ++$i)
{
echo '<td width="20" height="20">';
$dayarray = getdate($start);
if($dayarray['mon'] == $firstdayarray2['mon'])
{
if ($d==0 && (($firstdayarray['wday']) == $i || $i==7)) $d=1;
if ($d>0)
{
echo $d;
++$d;
$start += (60*60*24);
}
}
echo '</a></td>';
}
echo '</tr>';
}
echo '</table>';
}
kalendarz (10,2008);