Date: 08/30/99
- Next message: Zeev Suraski: "Re: [PHP-DEV] Re: PHP 4.0 Bug #2193 Updated: Global declared variables not gobalu"
- Previous message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #2193 Updated: Global declared variables not gobal"
- Next in thread: Zeev Suraski: "Re: [PHP-DEV] Re: PHP 4.0 Bug #2193 Updated: Global declared variables not gobalu"
- Reply: Zeev Suraski: "Re: [PHP-DEV] Re: PHP 4.0 Bug #2193 Updated: Global declared variables not gobalu"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> ID: 2193
> Updated by: zeev
> Reported By: lemming <email protected>
> Status: Closed
> Bug Type: Scripting Engine problem
> Assigned To:
> Comments:
>
> Your code is wrong.
> When you include a file from within a function, the included
> code is executed in the scope of that function. Thus, when you
> include t1.php from Test2(), $T=1 is executed in the scope of
> Test2(), and does not become a global variable. For that reason,
> global $T inside Test() does not attach to this variable.
>
I understand this. But:
a) Code which works standalone does not work when included from
a function, which IMHO is not a good behavior.
b) There is no simple way for the function to access the variable.
c) It should be noted win the "variable scope" chapter in the manual.
Michal Kara alias lemming
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Zeev Suraski: "Re: [PHP-DEV] Re: PHP 4.0 Bug #2193 Updated: Global declared variables not gobalu"
- Previous message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #2193 Updated: Global declared variables not gobal"
- Next in thread: Zeev Suraski: "Re: [PHP-DEV] Re: PHP 4.0 Bug #2193 Updated: Global declared variables not gobalu"
- Reply: Zeev Suraski: "Re: [PHP-DEV] Re: PHP 4.0 Bug #2193 Updated: Global declared variables not gobalu"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

