removing special characters

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

  1. #1
    This line $text = preg_replace('/[\s\r\n\t]/', ' ', $text);
    replaces special characters with white spaces. How do I remove special characters without replacing them with white spaces.
     
    t7584, Dec 3, 2006 IP
  2. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #2
    Instead of
    preg_replace('/[\s\r\n\t]/', ' ', $text);

    use:
    preg_replace('/[\s\r\n\t]/', '', $text);

    I think that is what you meant....
     
    papa_face, Dec 3, 2006 IP