Re: Syntax checker? Character replacing

From: Date: Fri, 06 Mar 2009 20:17:19 +0000
Subject: Re: Syntax checker? Character replacing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-289483@lists.php.net to get a copy of this message
On Fri, Mar 6, 2009 at 2:05 PM, Terion Miller <webdev.terion@gmail.com> wrote: > I have this and think maybe something is off, because if there is an amp (&) > in the location then it only displays a comma , and nothing else: > > if (isset($_SERVER['QUERY_STRING'])) {$Page .= ($_SERVER['QUERY_STRING']? > '?'. > str_replace("&","&amp;",$_SERVER['QUERY_STRING']) : > '');} > > > is that wrong? It looks alright to me, but I don't see the need for the in-line conditional statement since you've already run isset() on $_SERVER['QUERY_STRING']. Simplify your code: if(isset($_SERVER['QUERY_STRING'])) $Page .= str_replace('&', '&amp;', $_SERVER['QUERY_STRING']); Does that do the trick? -- // Todd

« previous php.general (#289483) next »