Forum Moderators: coopster

Message Too Old, No Replies

can't access global array

         

jackvull

3:46 pm on May 25, 2006 (gmt 0)

10+ Year Member



Hi
I've declare a global array and am setting various parts of it throughout a function:

function start_tag($parser, $name, $attribs)
{
global $current, $attribs2, $flagInMediaItems, $arrData;

$arrData['Number1'] = 1;
$arrData['Number2'] = 2;
etc. etc.

}

However, I don't seem to be able to access and print out the array at the end of my script.
The array doesn't have anything in it.
ANy ideas?

Thanks.

jackvull

3:49 pm on May 25, 2006 (gmt 0)

10+ Year Member



Forget it. I had to declare it as global in the function and it works now.

jatar_k

3:49 pm on May 25, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



maybe this thread will help find the problem
Understanding Custom Functions and Variable Scope in PHP [webmasterworld.com]

<added>alright then ;)