Variable Scope
Variable scope is a tricky but important concept. Every variable in PHP has a scope to it, which is to say a realm in which the variable (and therefore its value) can be accessed. As a rule of thumb, every variable has the scope of the page in which it resides. In other words, you can refer to a variable anywhere within a script once you’ve defined it (set its value). Assuming your PHP configuration has register_globals turned on, your form values can be accessed anywhere within the handling page.
Since included files act as if they were part of the original (including) script, variables defined before the include line are available to the included file. Further, variables defined within the included file are available to the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access