Re: str_replace does not like empty quotes [message #186202 is a reply to message #186198] |
Fri, 20 June 2014 03:26 |
Doug Miller
Messages: 171 Registered: August 2011
Karma:
|
Senior Member |
|
|
richard <noreply(at)example(dot)com> wrote in news:7heper378zqa.dovihixf4du2.dlg@
40tude.net:
> On Fri, 20 Jun 2014 03:19:53 +0200, Arno Welzel wrote:
>
>> 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,"\"","");
>>
>> 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 -> "
>
> That could be the problem as some times the \ shows and some times it
> doesn't.
> I've tried several combinatiosn, still the \ remains.
>
> As for the technically correct proper order it is
> search, replace, subject.
Indeed it is. But that's not what you're doing. And that's why it doesn't work.
|
|
|