Re: Wierd Variable Initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Title: Laruence's Signature
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux