PHP timetable day issue
<p>I've only included some of my timetable script (the part that deals with the days)</p>

<p>I noticed my timetable was working fine until the end of the month (everyday became a thursday) and so I went back into the script and I believe my timetable doesn't know when to detect if it is a new month so it continues to act like a counter 31, 32, 33 (day of month) which doesn't exist which is why it's giving me everyday as a thursday and saying the year was 1970.</p>

<p>The timetable shows 5 days from today - so it would show today and 4 others e.g. friday, saturday, sunday and monday.</p>

<p><strong>My code is as follows:</strong></p>

<pre><code>       &lt;?php
    }
    $timein = time();
    $d7 = date("H", $timein);
    $d6 = ($d7 +1) - 4;
    $d1 = date("d", $timein);

    $d2 = date("F", $timein);   
    $d3 = date("Y", $timein);
    $d4 = "$d2 $d3";
    $d5 = $d1 + 4;
    for( $i = $d1; $i &lt;= $d5; $i++ ) {
    $day = strtotime( "{$i} {$d4}" );
    $day = date( "d/m/Y", $day );

    ?&gt;
    &lt;table border="0" cellspacing="0" cellpadding="0" width="20%" style="float: left;"&gt;
    &lt;tr&gt;&lt;td&gt;
        &lt;div class="square title" style="padding: 3px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; width: 92%; text-align: center; bottom: 5px; margin-bottom: 5px; cursor: pointer; background: #79CDCD;"&gt;

            &lt;strong&gt;&lt;?php echo $day; ?&gt;&lt;/strong&gt;

        &lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;? } ?&gt;
</code></pre>

<p>Is there a solution or an easier way to perhaps do this sort of script?</p>

<p>Thank you  for your help in advance!</p>
