RE: [PHP] Is it possible to...
| From: | Rick Emery | Date: | Tue, 19 Feb 2002 15:52:51 +0000 |
| Subject: | RE: [PHP] Is it possible to... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85401@lists.php.net to get a copy of this message | ||
> Is it possible for function1() to access the variables that were defined
in the function2() namespace?
Must be defined with global construct, as you did in function1()
-----Original Message-----
From: Chris Boget [mailto:chris@wild.net]
Sent: Tuesday, February 19, 2002 9:52 AM
To: PHP General
Subject: [PHP] Is it possible to...
Given the following code:
<script language="php">
function function1() {
global $bob;
echo "Bob = $bob\n";
}
function function2() {
$GLOBALS[bob] = "Joe Bob Briggs";
function1();
}
function2();
</script>
function1() can echo out the value of $bob because it is
added to the global namespace in function2(). Is it possible
for function1() to access the variables that were defined in
the function2() namespace? Like some sort of "limited"
global or something? Something to allow called functions
access to the variable namespace of the calling function?
thnx,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php