Created
August 19, 2011 18:00
-
-
Save clarkgrubb/1157508 to your computer and use it in GitHub Desktop.
isset is the logical negation of is_null
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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