Re: pass globals to functions???

From: Date: Thu, 24 Oct 2002 20:16:24 +0000
Subject: Re: pass globals to functions???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-121349@lists.php.net to get a copy of this message
Many are arrays and will need to be modified. Thanks! Shawn "Kevin Stone" <kevin@helpelf.com> wrote in message news:0afa01c27b98$ea077d40$6601a8c0@kevin... > Unless the variables need to be modified I'd say use constants which are > free from the limitations of variable scope. > http://www.php.net/manual/en/function.define.php > > // example > define("SIZE", 100); > print_size(); > function print_size(){ > echo SIZE; > } > > -Kevin > > > ----- Original Message ----- > From: "Shawn McKenzie" <nospam@mckenzies.net> > To: <php-general@lists.php.net> > Sent: Thursday, October 24, 2002 1:52 PM > Subject: [PHP] pass globals to functions??? > > > > Some have eluded to this but I haven't seen a working example. I would > like > > to declare globals in my main script and then inside functions that need > > these globals just somehow use the $GLOBALS or something to declare the > > variables global in the function. > > > > What I've seen eluded to is loading your $GLOBALS array into an array... > > > > In short, if I add a variable to my globals line in my main script, I > don't > > want to have to go and add it to the functions that need it. Make > sense??? > > > > TIA > > -Shawn > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > >

« previous php.general (#121349) next »