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

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

 



Nathan Nobbe wrote:
> personally, i wont argue w/ the compact nature of the 
> statement; its nice. 

I agree. Very elegant. Thanks for the clarifications, folks.

> its mysterious statements like this that make code fragile, 
> imho. i prefer the modulus approach.

I would have agreed before reading the clarification. Not so sure
now...

At the risk of semantic nitpicking, and only because I find this
discussion stimulating (pity us poor geeks), I might call "($r=!$r)"
esoteric rather than mysterious, even though I'm the one who asked
the question, suggesting it was a mystery to me.

Garsh: In the early days, I thought I had to write:
if ( strval($somevar) > 0 )
or
if ( $somevar ) === true )

and found:
if ( strval($somevar) )
and
if ( $somevar )
mysterious.
!

I suppose my point is that some things start out as mysterious
simply because they are a bit esoteric, further down in the manual.

But I agree with you, Nathan, in principle, about mysterious code
making things fragile. When I first got comfortable with the ternary
operator, I went crazy trying to write cool one-liner conditional
statements with it. Then, months (or even days) later, when I needed
to make changes to those one-liners, I had to scratch my head a lot
to figure out what was what. I've since decided that sometimes, in
the interest of de-mystifying my own code, there's nothing like a
good old IF loop.

My $0.02.

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