Re: Wierd Variable Initialization

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

 



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()

I assume you mean $GLOBALS ..


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

Why set it to an empty array first? You're just overriding it straight away.

It's pretty silly to do:

<?php

$a = 1;
$b = 0;
$b = $a;

?>


Add:

error_reporting(E_ALL);
ini_set('display_errors', true);

to the top of your script.

Any errors/notices/warnings?

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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