oooh, here is easy sollution for global vars : <?php var_dump(array_key_exists('a',$GLOBALS)); $a = NULL; var_dump(array_key_exists('a',$GLOBALS)); ?> However there is no $LOCALS in the local scope.
Andrey ----- Original Message ----- From: "Cristiano Duarte" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, August 16, 2003 7:26 PM Subject: Re: [PHP-DEV] variable_exists() patch > "Stefan Walk" <[EMAIL PROTECTED]> escreveu na mensagem > news:[EMAIL PROTECTED] > > 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. > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php