AW: [STANDARDS] Documenting strange include behaviour

From: Date: Thu, 13 Nov 2014 16:06:30 +0000
Subject: AW: [STANDARDS] Documenting strange include behaviour
References: 1 2 3  Groups: php.standards 
Request: Send a blank email to standards-+get-563@lists.php.net to get a copy of this message
> -----Ursprüngliche Nachricht----- > Von: Robert Stoll [mailto:php@tutteli.ch] > Gesendet: Donnerstag, 13. November 2014 16:18 > An: 'Rowan Collins'; standards@lists.php.net > Betreff: AW: [STANDARDS] Documenting strange include behaviour > > > > > -----Ursprüngliche Nachricht----- > > Von: Rowan Collins [mailto:rowan.collins@gmail.com] > > Gesendet: Donnerstag, 13. November 2014 15:22 > > An: standards@lists.php.net > > Betreff: Re: [STANDARDS] Documenting strange include behaviour > > > > Robert Stoll wrote on 13/11/2014 14:11: > > > From the example above we can see that variables and constants > > > defined with define() do not remain in their namespace > > > > Constants defined with define() are never scoped to the current namespace, this is not > > related to the use of include. > > > > There's a user note in the manual which explains this rather well, and > > should probably be rolled into the text of the > manual > > itself: > > http://php.net/define#90282 > > > > Oh, I see, my fault, the behaviour of const and define is perfectly fine then. > That variables are transferred to the namespace they are included to seems ok to me as well > (that's at least what I > expected). In this sense global $var within foo is ok as well. > I guess that already covered all my open questions, thanks Rowan. I'll write up a section > in the spec. > I see some misconception here. I always thought variables defined in a namespace scope are only available in this specific namespace and not in others. But yeah, they are global and thus available in all namespaces (shame on me ^^). My fault, sorry for the confusion. Nevertheless, I'll write down some clarifications on what happens with global variables when they are included in a function or class

« previous php.standards (#563) next »