Fortuno, Adam wrote:

Chris makes a good point i.e., "unknown compared to anything is
unknown". His comment made me want to clarify my earlier note. In my
earlier example, I wasn't suggesting that-that logic be coded in the
database. I was assuming it would be in the page:


$TestNullValue = NULL;

If ($TestNullValue) {
        print "Evaluates to true!";
} else {
        print "Evaluates to false!";


I tested this, and it worked. Here is why, PHP (like pretty much every
other language) silently casts a NULL to false:
"When converting to boolean, the following values are considered FALSE:

- the boolean FALSE itself - the integer 0 (zero) - the float 0.0 (zero) - the empty string, and the string "0" - an array with zero elements - an object with zero member variables (PHP 4 only)
 - the special type NULL (including unset variables)" ("Booleans",, 05 Dec. 2008).

If you use the shortcut php check, but you can do it the longer way.

if ($value !== null) {

Can you turn off email notifications too please? It's rather annoying when it's on a public mailing list.

Postgresql & php tutorials

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to