Something about php calendar
<p>I am a new learner of PHP, now I want to use it to do a calendar like the following. There are something that I don't know.</p>

<ol>
<li><p>How to get the first day of the month is sunday or another?</p></li>
<li><p>How to output all the days of the month and emphasize today?</p></li>
</ol>

<p><img src="http://i.stack.imgur.com/Bq4SQ.jpg" alt="enter image description here"></p>

<p>The code:</p>

<pre><code>&lt;table  cellspacing="0" cellpadding="3" bordercolor="#000000" border="1" style="width: 105px; border-collapse: collapse;"&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
        &lt;td colspan="7"&gt;&lt;?php echo date('F')." ".date('Y');?&gt;&lt;/td&gt;
    &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;Su&lt;/td&gt;
         &lt;td&gt;M&lt;/td&gt;
         &lt;td&gt;Tu&lt;/td&gt;
         &lt;td&gt;W&lt;/td&gt;
         &lt;td&gt;Th&lt;/td&gt;
         &lt;td&gt;F&lt;/td&gt;
         &lt;td&gt;Sa&lt;/td&gt;
     &lt;/tr&gt;
     &lt;?php
   $numrows = ceil(date('t')/7);
   for($k=1;$k&lt;=$numrows;$k++){

         ?&gt;
      &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;?php }?&gt;

    &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>I don't know how to output the following days.</p>
