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

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

 



On Fri, 2007-10-05 at 13:46 -0500, Jay Blanchard wrote:
> [snip]
> > 
> > But why does the ($r=!$r) ternary condition work?. (I understand
> > that it DOES but not WHY.)
> [/snip]
> 
> Check this out -
> http://us3.php.net/manual/en/language.operators.assignment.php
> 
> It says the value of the assignment is the value assigned, so maybe
> assignments to anything other than 0 (or false) return true while
> assignments to 0 (or false) return false. 

The value of the expression is the value assigned. Since the ! operator
will always return a boolean then the assigned value is going to be a
boolean. So $r will always contain a boolean for the purposes of the
ternary operation.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
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