Re: newbie question about scope
| From: | Derek Ford | Date: | Wed, 12 Nov 2003 14:11:26 +0000 |
| Subject: | Re: newbie question about scope | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169260@lists.php.net to get a copy of this message | ||
news.comcast.giganews.com wrote:
I am an experienced web developer who is just getting into php. I have had a php project fall into my lap and wanted a little advice. Here is the scoop: A client moved their site from a server (unknown details) to a hosting facility (php 4.3.2). Now none of the scripts work. I have guessed that they are coming from an earlier version of apache/php. Anyway it appears that whoever created the site in the first place did not believe in scoping variables. Now any variable that is not properly scoped will not be read by the server. I know I can simply scope all of the variables, but I was hoping there may be an easier way. Also, how bad is the _REQUEST scope I read that "it could not be trusted", however the previous developer created the app in such a way that several places a variable could be _GET or _POST. I apologize for the rambling and possible incoherency of this message, I am a bit tired. Matthew PS. How do you scope queries? You're thinking about this in the wrong way, it seems. The server probably has register_globals Off, where previously he was programming with it being On. or vise-versa. They should be Off, and should be left off, but programming with them off needs some adjusting. Variables such as post and get data are now 'superglobals', and must use the appropriate arrays; $_GET[], and $_POST[]. There are things like extract(), but using them is not advised. as per your question about "scope queries", be more concrete :)