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


$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() );

    $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


It's included here:

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!"




PHP General Mailing List (
To unsubscribe, visit:

Reply via email to