Re: Wierd Variable Initialization

From: Date: Thu, 25 Sep 2008 02:47:46 +0000
Subject: Re: Wierd Variable Initialization
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-280900@lists.php.net to get a copy of this message
register_global = on ? VamVan wrote:
So guys, I found some thing strange that happened to me yesterday. Its small but kinda freaked me out. So I have a tokenmap.php that I include include in different configuration files. Some are classes and some are simple php files. So in my tokenmap.php I have declared an array as global. SO $GLOBAL['tokenmap'] = array() As a good programming practice what I did was: require_once('tokenmap.php'); $tokenmap = array(); $tokenmap = $GLOBAL['tokenmap']; print_r($tokenmap); The above displays empty array But when I do this , it works require_once('tokenmap.php'); $tokenmap = $GLOBAL['tokenmap']; print_r($tokenmap); Its kind of wierd for me. I am trying to understand. Can some one shed some light on it for me. Thanks
-- Baidu惠新宸 xinchen.hui* | * SYS *| * (+8610)82602112-7974 *|* Hi:laruence

« previous php.general (#280900) next »