Re: Idea to extend language: Explicitly setting variable scope inside user defined function (longer)

From: Date: Mon, 21 Oct 2002 10:42:01 +0000
Subject: Re: Idea to extend language: Explicitly setting variable scope inside user defined function (longer)
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-89791@lists.php.net to get a copy of this message
> Marco Tabini <marcot@tabini.ca> wrote... : > > Well, you have to admit that the issue of variable scope is the first > thing that hits someone who approaches PHP for the first time and comes > from other backgrounds, like C or ASP! > For me global vars are bad at all. If you want to use some value in a function then pass it to the function even if you want you can pass an array will variable ammount of vars that has names as indexes. Only the input must be global and it is global by using _GET/POST/REQUEST/FILES/SESSION With the PHP approarch you know which vars are defined in the function's scope only by looking the "global" statement. I agree that this is hard for newbie - it was hard for me, but now I don't have problems with that and if I eventualy need a global var I use $GLOBALS and not "global $foobar"; Regards, Andrey

« previous php.dev (#89791) next »