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

From: Date: Tue, 11 Aug 2009 18:28:21 +0000
Subject: Re: how to say "inverse your value" (to a boolean)?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-296648@lists.php.net to get a copy of this message
> # 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 ); > } > > +5000. I think is by far the most readable and flexible solution suggested. I also like it because it's PHPish -- it uses the features of the language that were made-to-order for this problem. Ben

« previous php.general (#296648) next »