FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » str_replace does not like empty quotes
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: str_replace does not like empty quotes [message #186206 is a reply to message #186205] Fri, 20 June 2014 09:02 Go to previous messageGo to previous message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma:
Senior Member
Arno Welzel, 2014-06-20 11:01:

> richard, 2014-06-20 04:13:
>
>> 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.
>
> No - it isn't - READ:
>
> <http://www.php.net//manual/en/function.str-replace.php>
>
>
> str_replace ( $search , $replace , $subject [, int &$count ] )
>
> This function returns a string or an array with all occurrences of
> search in subject replaced with the given replace value.

Sorry... Richard is really confusing to read sometimes - since he did
read the manual but did not use it...


--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PDO fetch with SQL server
Next Topic: Putting it all together
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 20:34:53 GMT 2024

Total time taken to generate the page: 0.03860 seconds