Re: note 8479 added to Class/Object Functions
| From: | Lars Torben Wilson | Date: | Wed, 13 Sep 2000 20:35:29 +0000 |
| Subject: | Re: note 8479 added to Class/Object Functions | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-4906@lists.php.net to get a copy of this message | ||
gurmukh@usa.net writes:
> Class objects in PHP don't seem to have access to any posted or environment variables.
>
> A work around would be to pass the variables through a function, or
> pass the $HTTP_POST_VARS array itself!
>
> http://www.php.net/manual/ref.classobj.php
This note has been deleted; the above is actually a scoping
issue. Class methods in PHP are subject to the same scoping rules as
other functions; ergo, to access variables from the global scope, you
need to either use the 'global' keyword or the $GLOBALS array.
More information is available here:
http://www.php.net/manual/language.variables.scope.php
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+