"Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having problems using global vars.  I have read the docs and all of
the
> notes but it's not helping.  Simplified example:
>
> /dir1/script2.php
> <?php
> $test = array ( 'a' => '1', 'b' => '2');
> ?>
>
> /dir1/script1.php
> <?php
> include("/dir1/script2.php");
> print_r($test);  //works great
> print_r($GLOBALS['test']);  //does not work
> ?>
>
> This is a local include so the vars should be in the global scope right?
> Any help please?
As far as I know, no defined variable is global by default. If you would
really need this variable to be global, you'll need to do a

global $test;

to make $test global.

HTH,

Ivo



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

Reply via email to