Re: Alternate Colors in Rows ($r=!$r)

From: Date: Fri, 05 Oct 2007 18:49:38 +0000
Subject: Re: Alternate Colors in Rows ($r=!$r)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-262836@lists.php.net to get a copy of this message
On 10/5/07, Jay Blanchard <jblanchard@pocket.com> wrote: > > > It looks like PHP has an "unintentional feature". Doing this; if($r = > !$r) should always return TRUE because it is an assignment. I don't know > if I would rely on this. > > its not an unintentional operation; its the order of operations. logical ! and the ternary ? : takes precedence over the assignment statement = http://us.php.net/manual/en/language.operators.php personally, i wont argue w/ the compact nature of the statement; its nice. its mysterious statements like this that make code fragile, imho. i prefer the modulus approach. -nathan

« previous php.general (#262836) next »