Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.CARNet.hr!gregory.BNet.hr!not-for-mail From: "A" Newsgroups: comp.lang.php Subject: Re: ampersand help Date: Sun, 4 Sep 2011 22:55:39 +0200 Organization: B.net Hrvatska d.o.o. Lines: 13 Message-ID: References: <7a650168-4b19-4033-b73d-3e96d33ce531@h6g2000yqe.googlegroups.com> NNTP-Posting-Host: dh207-14-117.xnet.hr X-Trace: gregory.bnet.hr 1315169817 17339 88.207.14.117 (4 Sep 2011 20:56:57 GMT) X-Complaints-To: abuse@globalnet.hr NNTP-Posting-Date: Sun, 4 Sep 2011 20:56:57 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-RFC2646: Format=Flowed; Original Xref: x330-a1.tempe.blueboxinc.net comp.lang.php:3073 > Can someone tell me why this line of code doesn't work for replacing > an ampersand? > $newstring = str_replace("&", "and", $newstring); There is no problem in that particular line. Perhaps the problem is elsewhere for example in initialization of $newstring ? What exactly are you trying to do? And what is the content of $newstring? Maybe a dumb question but are you trying to do this instead? $newstring = str_replace("&", "&", $newstring);