Skip to Content
Core PHP Programming, Third Edition
book

Core PHP Programming, Third Edition

by Leon Atkinson
August 2003
Intermediate to advanced
1104 pages
19h 27m
English
Pearson
Content preview from Core PHP Programming, Third Edition

4.3. Scope

In order to avoid clashes between variables in different functions, PHP includes the notion of scope. Each line of code belongs to a certain scope. Code that appears inside a function is considered to belong to the function's scope. Code that appears outside of any function is considered to belong to the global scope. The scope is the property that determines which memory table is used for storing variables and in turn which variables are accessible.

Variables declared inside a function scope are local variables. Local variables are the private property of a function and may never be seen or manipulated outside the scope of the function. Variables used outside the scope of any function are global variables. Unlike some other languages, ...

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.
Start your free trial

You might also like

Programming PHP, 3rd Edition

Programming PHP, 3rd Edition

Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre
Programming PHP

Programming PHP

Rasmus Lerdorf, Kevin Tatroe
Programming PHP, 2nd Edition

Programming PHP, 2nd Edition

Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre
Advanced PHP Programming

Advanced PHP Programming

George Schlossnagle

Publisher Resources

ISBN: 0130463469Purchase book