Multiple ways of doing truth tests (not operator, empty(), is_null(), isset()) + weak typing = this
With some discipline you can mostly avoid the need to refer to this table:
For general truth tests, you can use boolean comparison if ($)
{ ... } if (!$x) { ... }
. It behaves the way boolean operators in most languages do.
Always use empty()
if you want to test form input for falsy values (it treats "0" as false).
Always use isset()
if you want to determine whethere a variable is set or not
Use is_null()
or $x === NULL
if you only need to check for NULL