Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #13918

Re: str_replace does not like empty quotes

From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.php
Subject Re: str_replace does not like empty quotes
Date 2014-06-20 04:06 +0200
Message-ID <53A39732.5050107@arnowelzel.de> (permalink)
References <1kcemjreijezv$.k2q3x4bl6eoc.dlg@40tude.net> <53A38C39.3020405@arnowelzel.de> <53A38CB2.3090100@arnowelzel.de> <lo031j$79o$1@dont-email.me>

Show all headers | View raw


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

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

str_replace does not like empty quotes richard <noreply@example.com> - 2014-06-19 19:33 -0400
  Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 20:09 -0400
  Re: str_replace does not like empty quotes Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-06-19 20:11 -0400
    Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 20:55 -0400
    Re: str_replace does not like empty quotes Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-20 03:23 +0000
    Re: str_replace does not like empty quotes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-20 09:31 +0200
  Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 03:19 +0200
    Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 03:21 +0200
      Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 21:33 -0400
        Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 04:06 +0200
          Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 22:26 -0400
    Re: str_replace does not like empty quotes richard <noreply@example.com> - 2014-06-19 22:13 -0400
      Re: str_replace does not like empty quotes Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-20 03:26 +0000
      Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 11:01 +0200
        Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 11:02 +0200
          Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-20 15:38 +0000
      Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-20 15:32 +0000
  Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-20 01:59 +0000
  Re: str_replace does not like empty quotes Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-20 03:25 +0000
  Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-20 16:10 +1000
    Re: str_replace does not like empty quotes Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-20 13:48 +0200
      Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-20 15:40 +0000
      Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-22 10:05 +1000
        Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-21 20:08 -0400
          Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-23 09:20 +1000
            Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-22 20:44 -0400
              Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-23 16:33 +1000
                Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-23 09:07 -0400
                Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-24 12:34 +1000
                Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-23 23:07 -0400
                Re: str_replace does not like empty quotes Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-24 11:12 +0000
                Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-24 08:01 -0400
  Re: str_replace does not like empty quotes Olaf Schmitt <thesys@gmx.de> - 2014-06-24 08:13 +0200
    Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-24 10:44 +0200
      Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-24 18:48 +0000
        Re: str_replace does not like empty quotes Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-24 21:53 +0200
          Re: str_replace does not like empty quotes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-24 22:08 +0200

csiph-web