Re: help with _get error

From: Date: Wed, 23 Mar 2011 17:54:16 +0000
Subject: Re: help with _get error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-312015@lists.php.net to get a copy of this message
On Wed, Mar 23, 2011 at 10:46 AM, Jack <JackListMail@gmail.com> wrote: > I'm having a problem with this line of code which worked fine for years: > > $l_url2 = ".".$_GET[SERVER_NAME]; > Place quotes around the key. $l_url2 = ".".$_GET['SERVER_NAME']; Normally PHP treats SERVER_NAME as the name of a constant. There's a setting that allows PHP to treat it as a string if there is no constant with that name, but using that feature has drawbacks and is not good practice. It's possible that your PHP was upgraded or the setting was disabled. Either way, there is no downside to using quotes short of two keystrokes (one if you use a good editor), and you should get used to quoting your strings. Peace, David

« previous php.general (#312015) next »