RE: [PHP] Problem with quotes

From: Date: Fri, 22 Feb 2008 04:36:12 +0000
Subject: RE: [PHP] Problem with quotes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-269829@lists.php.net to get a copy of this message
> -----Original Message----- > From: Mário Gamito [mailto:gamito@gmail.com] > Sent: Thursday, February 21, 2008 11:04 PM > To: php-general@lists.php.net > Subject: [PHP] Problem with quotes > > Hi, > > Sorry for such a laim question. > > > > I have this code: > > $host = 'http://' . $_SERVER['HTTP_HOST']; > > "foreach($browser as $key => $val){ > echo "<img src=\"dcs/" . $key . '.png"' . " > />" . " "; > (...) " > > > but it has a bug, I need to add the server domain before the picture, so > I did: > > $host = 'http://' . $_SERVER['HTTP_HOST']; > > "foreach($browser as $key => $val){ > echo $host . "<img src=\"dcs/" . $key . '.png"' . > " />" . " "; > (...)" > > But this way, all it echoes is the $host variable. > > What am I missing here ? > > Any help would be appreciated. > > Warm Regards, > Mário Gamito Mmm... It may have to do with operator precedence Try either: <code> echo ($host . "<img src=\"dcs/" . $key . '.png"' . " />" . " "); </code> Or, <code> $output = $host . "<img src=\"dcs/" . $key . '.png"' . " />" . " "; echo $output; </code> Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION  5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 | Email: info@bestplace.net  | MSN Chat: best@bestplace.net  |  SKYPE: bestplace |  Web: bestplace.biz  | Web: seo-diy.com

« previous php.general (#269829) next »