Re: Simple function question

From: Date: Thu, 09 May 2002 19:08:00 +0000
Subject: Re: Simple function question
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-13660@lists.php.net to get a copy of this message
Use $GLOBALS['var1'] That will get the variable from the correct scope. -- Scott Carr OpenOffice.org Whiteboard-Doc Maintainer http://whiteboard.openoffice.org/doc/ Quoting Matt Babineau <mbabineau@illuminatistudios.com>: > Ok, I just read a section in a book about functions. In my cost I have > some variables set: > > $var1 = "1"; > > And I have a function I wrote that needs to utilize that variable. > > function runvar() { > query database looking for $var1; > } > > I get horrible errors though. In the book it talked about the local > fuciton scope not being able to communicate with the global scope. How > can I pass $var1 into the function so it can be used? > > Matt Babineau > Freelance Internet Developer > ----------------------------------------- > e: <mailto:mbabineau@illuminatistudios.com> > mbabineau@illuminatistudios.com > p: 603.943.4237 > w: <http://www.illuminatistudios.com/> http://www.illuminatistudios.com > > ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/

« previous php.windows (#13660) next »