Re: variable_exists() patch
| From: | Stefan Walk | Date: | Sat, 16 Aug 2003 21:51:57 +0000 |
| Subject: | Re: variable_exists() patch | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-4027@lists.php.net to get a copy of this message | ||
On Sat, Aug 16, 2003 at 02:42:17PM -0700, Lars Torben Wilson wrote:
> But the change would make it more consistent, by recognizing that a
> variable with a NULL value is still defined. Pretending that $foo =
> null and unset($foo) are the same thing is quite inconsistent and
> confusing for many, when there are ways (i.e. get_defined_vars()) to
> prove that they are not the same.
You can see that they are meant to be the same by doing
$foo = (unset)$foo; ... $foo is null afterwards :)
Anyway,
variable_exists($foo)
is just a synonym for
in_array('foo', array_keys(get_defined_vars()))
which is not too much trouble to type IMO. *shrug*
--
Regards,
Stefan Walk
<swalk@prp.physik.tu-darmstadt.de>