PHP task calendar performance improvement

I am trying to create a 7 day task calendar using PHP - The dates at this moment are not linked with the MYSQL Database - that's not my problem.

My current calendar only let you see tasks coming (those in future - today, tomorrow) but not in the past (yesterdays, last weeks) - which is how I like it.

Now , my problem being is , although my code is working successfully, it is slow at echo'ing and so I am looking for a quicker way to gain the same results using PHP.

<?
$day_count = 0;
$date= time();
$month = date('m', $date); 
$year = date('Y', $date);
$days_in_month = cal_days_in_month(0, $month, $year) ; 
$day_num = date("j", $date);

while ($day_num <= $days_in_month) { 

    while ( $day_count >=0 && $day_count <=7)  {
        ?>
        <div class="day"> <? echo $day_num; ?> </div> 
        <?
        $day_num++;
        $day_count++;
    }
}
?>

Answers


Is this the real code?

If it is, you can speed it up by getting rid of the outer loop. At the moment that loop does not do anything as it is true the first time and then the inner loop only runs once as you don't reset $day_count anywhere.


Need Your Help

java universal set function

java class set universal

I was thinking how implement set function to all fields, like in Calendar class.

How do you apply a .net attribute to a return type

c# .net attributes return-type

How do I apply the MarshalAsAttribute to the return type of the code below?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.