Magically Disappearing Global Variables?
Posted: Sun Sep 28, 2003 3:42 am
I was having trouble accessing a global in one of my functions. The global is an array named $config. If you will, please note the following chunk of code...
And its output...
...So PHP can see my variable, but it's not letting me do anything with it? What's going on here, and how can I fix it?
Code: Select all
<?php
function drawhead($pgtitle) {
print_r ($GLOBALS);
print_r ($config);
print_r ($GLOBALS);
// etc...
?>Code: Select all
Array
(
їHTTP_POST_VARS] => Array
(
)
ї_POST] => Array
(
)
їHTTP_GET_VARS] => Array
(
)
ї_GET] => Array
...etc...
їconfig] => Array
(
їid] => 1
їtemp] => default
їdatefmt] => D j M Y g:i A
їsitetitle] => Phanatix-Powered Site
їlang] => en-us
їmaxarts] => 0
їcatsep] => ,
їcxn] => Resource id #4
їver] => 0.001
їpre] =>
)
...etc...
<br />
<b>Notice</b>: Undefined variable: config in <b>/Users/albright/Sites/phanatix/incl/dohead.php</b> on line <b>32</b><br />
Array
(
їHTTP_POST_VARS] => Array
...etc...
їconfig] => Array
(
їid] => 1
їtemp] => default
їdatefmt] => D j M Y g:i A
їsitetitle] => Phanatix-Powered Site
їlang] => en-us
їmaxarts] => 0
їcatsep] => ,
їcxn] => Resource id #4
їver] => 0.001
їpre] =>
)