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

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

 



[snip]
if($r = !$r)
[/snip]

And I hit send before I finished my thought process oh my goodness isn't
it five o'clock yet and why do all of these people keep coming by my
office distracting me from getting something useful done like replying
the PHP list and why doesn't someone bring me a beer?

if($r = !$r) is a conditional check that most folks would read as
follows;

if the assignment of $r to !$r occurs the statement is TRUE. Since PHP
is loosely typed we all know that an assignment will occur regardless of
what is assigned. That why we use additional operators to determine the
TRUEness of a statement;

if($r == !$r) or if($r === !$r) 

That is why we code conditional checks (if we're smart) by putting the
constant on the left hand side of the check to reduce/locate
typographical errors when coding conditional checks; if(1 == $foo),
because if we assign $foo to 1 the compiler will throw an error and we
can fix it pretty quickly.

This is one of those special cases where this logic gets thrown out. I
am going to see if the same thing will work in C++ because I am pretty
sure that no other language has this feature....maybe C.

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