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:
Rasmus Lerdorf 1999-12-08 12:23:24 +00:00
parent 170e1ebf6d
commit 3991af6590

View file

@ -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>