Re: Calling symbol table patch
| From: | Andrei Zmievski | Date: | Mon, 20 Nov 2000 23:06:21 +0000 |
| Subject: | Re: Calling symbol table patch | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-38719@lists.php.net to get a copy of this message | ||
On Sun, 19 Nov 2000, Sterling Hughes wrote:
> The original purpose of the function as I created it was simply to output
> debug information, therefore:
>
> var_dump(get_defined_vars());
>
> Was easier than:
>
> var_dump(array_keys($GLOBALS));
> var_dump(get_defined_vars());
But your semantics are incorrect here, then. Global variables are not
automatically defined in the local scope, so get_defined_vars() should
not return them.
> The way I see it there are a few options -->
>
> 1) Keep with my patch. This will not be so bad as long as you define
> "current" as the first argument.
> 2) Modify it so that the contents of variables in the current scope are
> returned, but not variables in the global
> scope. (this sucks imho)
Why?
> 3) Break compatibility. The get_defined_vars() and get_defined_functions()
> functions have not (to my knowledge) been formally announced, therefore
> I don't think it will be killer to break compatibilty in get_defined_vars()
> and have it simply return the current scope. (I like this the best)
That's what I suggested - just return the current scope.
> I also don't think it should be get_symbol_table() since if I'm the average
> user I know what a variable is but a symbol table, is that like some weird
> Perl thing? :)
Never hurts to educate people.
-Andrei
* Anything will fit if you push hard enough *