Results 1 to 7 of 7

Thread: Replace??

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Replace??

    I have this code:

    PHP Code:
    $fcode str_replace(" ( ""("$fcode);
    $fcode str_replace(" ) "")"$fcode);
    $fcode str_replace(" . ""."$fcode);
    $fcode str_replace(" ' ""'"$fcode);
    $fcode str_replace(" , "","$fcode); 
    I don't think str_replace accepts multi-deliminators, but what about others like preg_replace, or ereg_replace? Do any of these do this? And what would the syntax look like?

    I'm looking for soemthing like:

    $fcode = _replace(" ( \ ) \ . \ ' \ , \", "(\)\.\'\,\", $fcode);
    Is there anything like this?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    this is from php.net

    preg_replace vs. str_replace.
    str_replace is about 25% faster on a single match in a short string, and
    gets increasingly faster as the number of matches increases. (It hits 38%
    on the second match...) Whole-script times for 10000 matches in a loop
    only showed 14% differences in runtime: if you're running a script that
    does ONE match as a test, you'll see absolutely no difference in runtime
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  3. #3

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I don't think that helps me...
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    scoutt
    Guest
    leave it like you have it.

  5. #5
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    thats what i was going for
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  6. #6

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Ah, I gotcha now. I just thought there might have been a way to do it without so many lines.

    Thanks for the assistance.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    no prob
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width