|
| |
1. variable scope in fcns |
|
Reply |
|
|
 Brian Read | 2008-10-24 15:53:44 |
I have this:
a = 23;
function level1()
{$a = 29;level2();echo "<p>".$a."</p>";
}
function level2()
{global $a;echo "<p>".$a."</p>";
}
level1();
echo("Hello, World!" );
?>
The "global" makes $a take on the value of 23, whereas i really need to get it to take on the value of 29.
Clearly this is a simple example of a problem i have which is more complex! |
There are 5 replies in this thread, which are not being displayed. Browsing this forum thread replies is available only to premium subscribers.
Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum. |