Re: Calendar Problem
| From: | tedd | Date: | Wed, 12 Aug 2009 14:28:31 +0000 |
| Subject: | Re: Calendar Problem | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296700@lists.php.net to get a copy of this message | ||
At 11:03 AM -0300 8/12/09, Martin Scotta wrote:
Hi all This is my point of view. I try to stay the most legible and simple as possible. @tedd: can you benchmark this script too? usualy legibility > performance <?php $fridays = array(); # I'll store the friday here $day = strtotime('-1 month', time() ); # let's start at one month ago while( 5 != date('w', $day)) # advance to a fridayMartin: It's included here: http://php1.net/b/fridays/ Works great -- thanks. As Shawn said "Many ways to skin a cat" As Jeff Foxworthy added "But he ain't going to like any of them!" Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com$day = strtotime('+1 day', $day);# I'll stop when $day where ahead one month from today $end = strtotime( '+1 month', time() ); do{$friday[] = date('Y-m-d', $day); # store the friday $day = strtotime('+1 week', $day); # advance one week} while( $day < $end ); # job's done! print_r( $friday ); -- Martin Scotta