While NULL in C is a macro with different implementations for a NULL-Pointer such as "0" or a void* cast for "0" (void *)0, NULL in PHP and MySQL has a special meaning. If you test in PHP NULL against an empty string or an empty array you will get true, assumed you don't use typesafe relational operators (=== or !==).

The title of this article is "logical operations with NULL" - so let's see how the results will look like, when we have a real NULL as an operand.

The first results are the same - but what happens with the results where we have a NULL operand? When you go the list from top to bottom you could think about the following defintion: "MySQL implements logical operations by look at the first operand and decide if you use the first or second operand". But this definition is depricated when you arrived (NULL || 0): NULL. Now you could think MySQL looks at a casted version of NULL - 0 - so skip this value and look what is in the second. This is 0 too so use the first operand. But no; The only logical conclusion is that MySQL gives NULL a special meaning. My definition for this manner looks as follows: "A expression is ever NULL if one operator is NULL and the interpreter arrives this without a logical exclusion."By the way - this behavior for SQL was described by Edgar Codd.