1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I remove all symbols (for example "\") from a text string.

Discussion in 'PHP' started by t7584, Dec 5, 2006.

  1. #1
    How do I remove all symbols (for example "\") from a text string.
    example
    55555\444444
    must be 55555444444
     
    t7584, Dec 5, 2006 IP
  2. Angelus

    Angelus Well-Known Member

    Messages:
    1,622
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    138
    #2
    Angelus, Dec 5, 2006 IP
  3. dilute

    dilute Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This will remove everything apart from A-Z a-z 0-9 and space

    $new_string = ereg_replace("[^A-Za-z0-9 ]", "", $string);
     
    dilute, Dec 5, 2006 IP
  4. Angelus

    Angelus Well-Known Member

    Messages:
    1,622
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    138
    #4
    Nice solution :)

    p.l.u.r.
     
    Angelus, Dec 5, 2006 IP
    dilute likes this.
  5. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #5
    If you're only looking to remove \, then you can also use strip_slashes();
     
    jestep, Dec 5, 2006 IP