NYCPHP Meetup

NYPHP.org

global variables

Bhulipongsanon, Pinyo Pinyo.Bhulipongsanon at usa.xerox.com
Thu May 22 09:03:59 EDT 2003


Hi all,

I have questions regarding global.  It appears that my program that uses
global no longer work consistently.  I think because global has been turned
off in newer server.  I only need global variables so that functions can use
them, however I really do not want to pass everything by value to the
function.

So this code is out:

global $var1, $var2;

I don't know if I should use session (cost?):

declare $_SESSION['var1']... outside the function and do the reverse inside
the function

My current solution is to use $_GET:

declare $_GET['var1']... outside the function and do the reverse inside the
function, i.e., $var1 = $_GET['var1']

Can someone tell me if there's anything wrong with this last option?  I
don't want to use 2nd option because my program is an include file so I
cannot use session_start() consistently.

Thank you,

Pinyo



More information about the talk mailing list