Re: Wierd Variable Initialization
| From: | Chris | Date: | Thu, 25 Sep 2008 03:00:52 +0000 |
| Subject: | Re: Wierd Variable Initialization | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280901@lists.php.net to get a copy of this message | ||
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 arrayWhy 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/