From 3991af65901fc8b8d79523b7eb9e1aa9c36076a3 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Wed, 8 Dec 1999 12:23:24 +0000 Subject: [PATCH] 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 --- language/variables.sgml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/language/variables.sgml b/language/variables.sgml index f35adc7f2d..277e219342 100644 --- a/language/variables.sgml +++ b/language/variables.sgml @@ -509,7 +509,18 @@ $bar = &test(); // Invalid. 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: + + + +$a = 1; +include "b.inc"; + + + + 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: