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

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

 



On 10/5/07, Jay Blanchard <jblanchard@xxxxxxxxxx> 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

[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