note 22296 added to language.types.null

From: Date: Thu, 13 Jun 2002 08:13:09 +0000
Subject: note 22296 added to language.types.null
Groups: php.notes 
Request: Send a blank email to php-notes+get-31787@lists.php.net to get a copy of this message
Hi, Function for looking if it is a NULL <?php $var = NULL; if (isnull("var")) { echo "var===NULL\n"; } else { echo "var!==NULL\n"; } if (isnull("test")) { // give FALSE, test is not set echo "test===NULL\n"; } else { echo "test!==NULL\n"; } $array['var'] = NULL; if (isnull("var", $array)) { echo "array['var']===NULL\n"; } else { echo "array['var']!==NULL\n"; } function isnull($var, $base = FALSE) { if ($base===FALSE) { $base = &$GLOBALS; } elseif (!is_array($base)) { return FALSE; } if ((array_key_exists($var, $base))&&($base[$var]===NULL)) { return TRUE; } else { return FALSE; } } ?> -- http://www.php.net/manual/en/language.types.null.php http://master.php.net/manage/user-notes.php?action=edit+22296 http://master.php.net/manage/user-notes.php?action=delete+22296 http://master.php.net/manage/user-notes.php?action=reject+22296

« previous php.notes (#31787) next »