importing vars into caller's namespace
| From: | glen | Date: | Thu, 07 Dec 2000 18:45:26 +0000 |
| Subject: | importing vars into caller's namespace | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-29184@lists.php.net to get a copy of this message | ||
is there any way of creating, modifying variables in caller's namespace
in php?
i can do global vars for that, but that means i still have to declare
them as global in caller :(
i was thinking of such construct:
<?
function import_vars() {
$caller->foo = 123;
}
import_vars();
echo $foo; # prints 123;
function test1() {
import_vars();
print $foo; #prints also 123
}
test1();
?>
--
glen
Don't be overly suspicious where it's not warranted.