Re: Scope of include

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

 



Robert Cummings wrote:
To answer his question though, variables not declared via the "global"
keyword and not accessed via the super global variables ($GLOBALS,
$_SESSION, etc) inherit the scope in which the include statement occurs.
Therefore, if in the included file all you have is:

    $foo = 'foo';

Then it's scope is the function including the file.

It's important to have this clear in your head when dealing with included files, so I wrote an example that will hopefully demonstrate it for the OP...

    http://dev.stut.net/php/scope/

-Stut

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