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 friday
$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
Martin:
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php