Re: Re: global scope issue
| From: | Shawn McKenzie | Date: | Wed, 13 Aug 2003 15:43:08 +0000 |
| Subject: | Re: Re: global scope issue | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159447@lists.php.net to get a copy of this message | ||
Sorry... nevermind. I was developing as part of a team and it seems that my
script is included in a function written by someone else. So my vars from
my included files are local to the other function and not global.
Thanks!
Shawn
"Shawn McKenzie" <nospam@mckenzies.net> wrote in message
news:20030813153709.96816.qmail@pb1.pair.com...
> does it matter if a global command has bee issued before with vars other
> than the $test var? i.e before the include if there is a global $somevar;
>
> -Shawn
>
> "Curt Zirzow" <curt@zirzow.dyndns.org> wrote in message
> news:20030813152344.GH462@bagend.shire...
> > * Thus wrote Ford, Mike [LSS] (M.Ford@lmu.ac.uk):
> > > > -----Original Message-----
> > > > From: Ivo Fokkema [mailto:I.F.A.C.Fokkema@LUMC.nl]
> > > > Sent: 13 August 2003 15:45
> > > >
> > > > "Shawn McKenzie" <nospam@mckenzies.net> wrote in message
> > > > news:20030813142705.28520.qmail@pb1.pair.com...
> > > >
> > > > As far as I know, no defined variable is global by default.
> > > > If you would
> > > > really need this variable to be global, you'll need to do a
> > > >
> > > > global $test;
> > > >
> > > > to make $test global.
> > >
> > > Absolute rubbish!! ALL variables used in the global scope are
> automatically
> > > global and available in the superglobal array $GLOBALS. You're
> confusing
> > > this with the issue that global variables are not automatically
> accessible
> > > within functions but must be "imported" with the global statement.
(And
> a
> > > global statement in the gloabl scope has absolutely no effect
> whatsoever.)
> >
> > I also believe php gives a warning/error about globaling a global
> > var in global scope.
> >
> > Curt
> > --
> > "I used to think I was indecisive, but now I'm not so sure."
>
>