Create a gist now

Instantly share code, notes, and snippets.

isset is the logical negation of is_null
$ uname -v
Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386
$ php --version
PHP 5.3.4 (cli) (built: Dec 15 2010 12:15:07)
$ php -a
Interactive mode enabled
<?
$null = NULL;
if ( is_null($null) ) {
echo "null is NULL\n";
}
if ( ! isset($null) ) {
echo "null is not set\n";
}
if ( is_null($not_set) ) {
echo "not_set is NULL\n";
}
if ( ! isset($also_not_set) ) {
echo "also_not_set is not set\n";
}
?>
null is NULL
null is not set
not_set is NULL
also_not_set is not set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment