|
Posted by arundelo on 07/01/07 23:24
gosha bine wrote:
> You could also inspect the symbol table directly via
> get_defined_vars
Ah yes! (This also occurred to me after my original post.)
$Vars = get_defined_vars();
if (isset($Foo) || array_key_exists('Foo', $Vars)) {
// Safe to evaluate $Foo:
var_dump($Foo);
} else {
echo "Not safe to evaluate \$Foo.\n";
}
> but that's ugly.
Indeed, but not quite as bad as my other solution.
Andrew Hutchings wrote:
> You could use is_null().
Nope, is_null() always tries to evaluate its argument, so an
E_NOTICE might be emitted.
--
Aaron
http://arundelo.com/
Navigation:
[Reply to this message]
|