note 32403 deleted from language.variables.scope by derick

From: Date: Tue, 27 May 2003 06:40:21 +0000
Subject: note 32403 deleted from language.variables.scope by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-49067@lists.php.net to get a copy of this message
Note Submitter: louie@zibi.co.il ---- scope after register globals turn off is not so clear ! just to clarify things to newbie function createAglobal(){ global $var $var = "value"; } //you MUST call the function to use the global $var createAglobal(); echo $var; //you will get value //if you use echo without calling the function you will // get Undefined variable: var error i know it might be // obvious for some but i think a lot of people dont // think that might be there problem function readAglobal(){ global $var; echo "this it my global $var";// will work } createAglobal(); readAglobal(); //will echo this is my global value i do hope you will find this info helful best regards

« previous php.notes (#49067) next »