Getting ahold of calling symbol table
| From: | Andrei Zmievski | Date: | Mon, 20 Nov 2000 20:24:03 +0000 |
| Subject: | Getting ahold of calling symbol table | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38666@lists.php.net to get a copy of this message | ||
I've run into a few situation where I needed to know values of variables
as they existed in the outer calling scope. Having failed to locate a
way to do it generically I came up with the attached patch. It changes a
couple of things in Zend and implements a get_calling_symbol_table()
function.
<?
foo();
function foo()
{
$bar = 5;
bar();
}
function bar() {
var_dump(get_calling_symbol_table());
}
?>
Results in:
array(1) {
["bar"]=>
int(5)
}
If no one objects, I'd like to go ahead and commit it.
-Andrei
* There is no knowledge that is not power. *