Web lists-archives.com

[PHP] Re: How Do I make Global Scope Variables Available to Functions




On 28.05.2018 at 02:46, John wrote:

> I am writing a PHP script that has a number of variables that (I think) are in
> Global scope; that is, they are defined inline before the first command of the
> script.  Note that these are not necessarily constants as shown in the example I
> included; most of them can be changed by the script.
> 
> I have functions defined following these variables and before the commands in
> the script appear, but when they are called, the functions report the variables
> as undefined.  This means I have to pass all the Globals to each function as a
> call argument.  
> 
> This seems odd but I don't see what I am doing wrong.  Any suggestions?

See
<http://php.net/manual/en/language.variables.scope.php#language.variables.scope.global>.

-- 
Christoph M. Becker

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