Re: global scope issue
| From: | Rob Adams | Date: | Wed, 13 Aug 2003 18:07:01 +0000 |
| Subject: | Re: global scope issue | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159464@lists.php.net to get a copy of this message | ||
Don't you just hate it when the thread your replying to has gone on to some
other thread that you didn't notice?
-- Rob
"Rob Adams" <rob_adams@hotmail.com> wrote in message
news:20030813180446.11466.qmail@pb1.pair.com...
>
> "Shawn McKenzie" <nospam@mckenzies.net> wrote in message
> news:20030813142705.28520.qmail@pb1.pair.com...
> > I'm having problems using global vars. I have read the docs and all of
> the
> > notes but it's not helping. Simplified example:
>
> Simplified? So maybe what you're giving us doesn't include the problem?
> The scripts below work for me.
>
> >
> > /dir1/script2.php
> > <?php
> > $test = array ( 'a' => '1', 'b' => '2');
> > ?>
> >
> > /dir1/script1.php
> > <?php
> > include("/dir1/script2.php");
> > print_r($test); //works great
> > print_r($GLOBALS['test']); //does not work
> > ?>
> >
>
> When I've had similar problems it has almost always been because I'm
trying
> to access the variable inside a function without declaring it as global.
>
> > This is a local include so the vars should be in the global scope right?
> > Any help please?
> >
> > TIA
> > -Shawn
> >
> >
> >
> >
>
>