Section 5.8. Variable Scope


5.8. Variable Scope

Each variable has a life span in which it exists, known as its scope . It is technically possible for a PHP script to have several variables called $a in existence at one point in time; however, there can only be one active $a at any one time.

Any variables not set inside a function or an object are considered globalthat is, they are accessible from anywhere else in the script, except inside another function or an object. We'll be looking at function and object scope later on, but for now, it is necessary only to understand that it is possible to have multiple variables of the same name.



PHP in a Nutshell
Ubuntu Unleashed
ISBN: 596100671
EAN: 2147483647
Year: 2003
Pages: 249

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net