Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: str_replace does not like empty quotes Date: Fri, 20 Jun 2014 04:06:42 +0200 Lines: 60 Message-ID: <53A39732.5050107@arnowelzel.de> References: <1kcemjreijezv$.k2q3x4bl6eoc.dlg@40tude.net> <53A38C39.3020405@arnowelzel.de> <53A38CB2.3090100@arnowelzel.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net FsLdi5pR7OXRSiT2DbG/BQV3Ro7sWdsz7zPTlmSiS9o1F+g34n Cancel-Lock: sha1:SwLaoXobeAeu5ecGaYvLGQkD24g= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-Enigmail-Version: 1.6 Xref: csiph.com comp.lang.php:13918 Jerry Stuckle, 2014-06-20 03:33: > On 6/19/2014 9:21 PM, Arno Welzel wrote: >> Arno Welzel, 2014-06-20 03:19: >> >>> richard, 2014-06-20 01:33: >>> >>>> $a=str_replace($a,"\",""); >>>> >>>> This generates the error: Unexpected "". >>>> >>>> http://www.php.net//manual/en/function.str-replace.php >>>> >>>> While here in the manual, they do precisely the same thing! >>> >>> No - they don't! >>> >>> Use: $a=str_replace($a,"\"",""); >> >> Sorry - of course: $a=str_replace("\"","",$a); >> >> Since the order of the parameters is >> >> 1) What to search >> 2) What to replace >> 3) Where to search in >> >>> Beware of the double quotes, since \ starts an escape - this means, the >>> meaning of the second quote (") is NOT "end string here". >>> >>> To make this more clear: >>> >>> >>> " <- String starts here. \" <- This just ONE character end here -> " >> >> > > Arno, that will replace the double quotes ("), which doesn't look like > what Richard wants. Well - I don't know, what Richard really wants. If it was about removing backslashes: $a=str_replace("\\","",$a); > But why help him when all he does is insult the same people who try to > help him? That's exactly why I didn't just give him the answer in the > first place (not to mention the fact he's asked similar questions > before, and has still failed to learn). I don't want to give newbies the impression, that Richard knows, what he is writing about, when he claims that things he does are exactly shown like that in the PHP manual ;-) -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de