Re: Object scoping and form variables in PHP4
| From: | Simon Edwards | Date: | Mon, 14 Aug 2000 23:44:51 +0000 |
| Subject: | Re: Object scoping and form variables in PHP4 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11708@lists.php.net to get a copy of this message | ||
Chris Mayes wrote:
> Is there a non-hackish way to import form variables into the object's
> scope? Should I send the HTTP_GET/POST_VARS into the object and step
global $HTTP_POST_VARS;
reset($HTTP_POST_VARS);
while(list($name,$val) = each($HTTP_POST_VARS)) {
...
}
...probably does what you want.
> This
> question may set some purists' teeth on edge, but why doesn't PHP4
> allow an object created and called within a page's scope to access
> variables from that page's symbol table? From what I've seen,
> variables local to the object would either be called with the $this->
> syntax or would be defined locally within the scope of a method.
http://www.php.net/manual/language.variables.scope.php
and read up on the global keyword.
--
Simon Edwards
Animated Design, Melbourne
http://www.animated.net.au/ Ph: (03) 98850990