--- Ryan A [EMAIL PROTECTED] wrote:
I thought i knew the useage of the global keyword in a function but
after reading a pals program i am really confused, i tried
http://php.net/global but that does not give me any results...searched
the list and found some reference to global and the scope of the
function but still confused.
Anybody have a good link or can give me a place to read up on the
defination with an example?
There are two scopes you need to understand in order to grok this:
1. Global
2. Function Local
Most normal variables are global. There are, of course, the
superglobals that PHP provides, but a $foo that you create is global.
The exception is when you create $foo within a function. In this case, its
scope is local to that function only. If you want it to be global instead,
you can declare it as such.
As a result of this, there are two ways that a function can manipulate
global data:
1. The variable is passed in by reference.
2. The variable is declared to be global.
Hope that helps.
Chris
=
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php