At 10:27 AM -0300 8/11/09, Martin Scotta wrote:
A change request just came in - the interaction designer wants every
third line to have a grey background, instead of every second line.

# before was $styles = array( 'even', 'odd' );
# after new requirements it is...
$styles = array( 'white', 'white', 'gray' );
foreach($items as $item)

printf( '<li class="%s">%s</li>', current( $styles ), $item );

next( $styles ) or  reset( $styles );


The simplest solution is always the best choice.
This provides maintainability and flexibility to changes ( that we don't know yet )

Martin Scotta

The "simplest solution" is in the eyes of the beholder.

My solution was the simplest for the problem presented.

You presented a different problem with a different solution.




PHP General Mailing List (
To unsubscribe, visit:

Reply via email to