note 95104 deleted from language.variables.scope by danbrown

From: Date: Fri, 18 Dec 2009 15:41:29 +0000
Subject: note 95104 deleted from language.variables.scope by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164109@lists.php.net to get a copy of this message
Note Submitter: conor dot rafferty at altsoft dot NI dot com ---- It seems you don't even need to declare a global variable in the global scope. Consider.. <?php function set_global() { GLOBAL $g; $g = "I was not declared in the global scope"; } function read_global() { GLOBAL $g; echo $g; } set_global(); read_global(); ?> displays: I was not declared in the global scope I am maintaining a body of legacy code and before I grasped this I was wasting time fruitlessly searching for variable declarations in the global scope, that just did not exist! Hope this help s/o else.

« previous php.notes (#164109) next »