You are here: Re: Slow performance using strtotime on prior 1970 dates « PHP Programming Language « IT news, forums, messages
Re: Slow performance using strtotime on prior 1970 dates

Posted by cla on 09/14/07 20:06

On Sep 14, 12:59 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
> On Sep 14, 3:22 pm, cla <cla...@gmail.com> wrote:
>
> > I'm using this code on an application to track football schedules:
> > ----
> > $season = '2005';
> > $basedate = strtotime('this friday', strtotime('31 August '.$season));
>
> > for($d=0;$d<=31;$d++) {
> > $d2=strtotime("+".$d." day",$basedate);
> > echo(date('m d Y',$d2)."\n");}
>
> > ----
> > The purpose is to find the first Friday on or after Aug. 31 in a given
> > year. Plug '2005' into $season, and it flies through. Plug in
> > '1905', however, and each step in the for loop takes about .5 sec.
> > I'm running this code in PHP 5.2.1. Any ideas?
>
> If all you want to do is find the first Friday on or after August 31
> why do you need the loop?

The loop's more for a demo. In the live app, there's a drop down list
of possible dates within a given week of a season. The first Friday
is just the starting point from which all subsequent dates are
referenced.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация