[nycphp-talk] Boolean evaluation (PHP vs Java)
Tim Gales
tgales at tgaconnect.com
Tue Jan 15 12:14:25 EST 2008
paul at devonianfarm.com wrote:
>[...]
> One of the most controversial features of languages such
> as PHP and Perl is the lax evaluation of boolean values
If you look at
http://nyphp.org/phundamentals/variableevaluation.php
You will see a table which shows how variables can be tested.
Beneath the table the article says:
"This table demonstrates somewhat surprising results..."
It talks about "... 0 (the integer), FALSE, and NULL..."
The article also mentions that you have to take into
account variables which are unset (even though unset is
not a variable in a strict sense)
To me this is somewhat like in a database query
which selects from a column (attribute) which can
contain nulls. You have to add 'and column != NULL'
in order to take into account the fact that the
data is not guaranteed to be a strictly 'either/or'
situation.
--
T. Gales & Associates
'Helping People Connect with Technology'
http://www.tgaconnect.com
More information about the talk
mailing list