mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Clarify that the global scope spans included files
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@16872 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
170e1ebf6d
commit
3991af6590
1 changed files with 12 additions and 1 deletions
|
@ -509,7 +509,18 @@ $bar = &test(); // Invalid.
|
|||
|
||||
<simpara>
|
||||
The scope of a variable is the context within which it is defined.
|
||||
For the most part all PHP variables only have a single scope.
|
||||
For the most part all PHP variables only have a single scope. This
|
||||
single scope spans included and required files as well. For example:
|
||||
</simpara>
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
$a = 1;
|
||||
include "b.inc";
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
<simpara>
|
||||
Here the $a variable will be available within the included b.inc
|
||||
script.
|
||||
However, within user-defined functions a local function scope is
|
||||
introduced. Any variable used inside a function is by default
|
||||
limited to the local function scope. For example:</simpara>
|
||||
|
|
Loading…
Reference in a new issue