Re: how to say "inverse your value" (to a boolean)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux