note 101535 deleted from function.isset by danbrown
| From: | danbrown@php.net | Date: | Thu, 23 Dec 2010 13:38:04 +0000 |
| Subject: | note 101535 deleted from function.isset by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175164@lists.php.net to get a copy of this message | ||
Note Submitter: francois vespa
----
Concerning last note I've posted, this IS actually the correct way to see if a variable has
been set even if it was set to NULL.
<?php
$foo=null;
return
isset($foo) || array_key_exists('foo',get_defined_vars())
? true : false ;
// will return true
return
isset($inexistent) || array_key_exists('inexistent',get_defined_vars())
? true : false ;
// will return false
?>
Sorry for the troll ;P