Re: variable_exists() patch
| From: | Cristiano Duarte | Date: | Sat, 16 Aug 2003 16:26:41 +0000 |
| Subject: | Re: variable_exists() patch | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-4020@lists.php.net to get a copy of this message | ||
"Stefan Walk" <swalk@prp.physik.tu-darmstadt.de> escreveu na mensagem
news:20030816075011.GA3576@prp0.prp.physik.tu-darmstadt.de...
> class Foo {
> function dump() {
> var_dump(array_key_exists('bar', (array)$this));
> }
> }
> $foo = new Foo;
> $foo->bar = null;
> $foo->dump();
> // => bool(true)
>
> It's not that hard to detect.
IMHO, array_key_exists can be used this way, but it shouldn't. The function
name has a meaning specific for arrays. We must have a not so specific way
to detect if a variable(or attribute) exists or not.
Cristiano Duarte.