Click to See Complete Forum and Search --> : use classes or variables inside functions.


cafrow
12-14-2005, 08:54 PM
I cannot believe I have never run into this problem before, and I really cannot believe this is being such a large problem for me. Anyways what I am trying to do is use 1 file, config.php that holds the info for connecting to my MySQL server, then a second file with all my functions func.php. In the function file I have a bunch of functions that I use such as checking login, loging users out, all that good stuff. Anyways what I am trying to do is be able to declare a variable that I will be able to use inside of functions and basicly anywhere while running that script. Is there a way to make a public variable??

Thanks

SpectreReturns
12-14-2005, 09:02 PM
Use the global keyword to define globals, or search in the $GLOBALS superglobal to find all variables in the root scope.

cafrow
12-14-2005, 09:03 PM
got it, thanks, I knew it had to be possible.