How to remove all non-alphanumeric and non-space characters from a string in PHP?

Posted by Daniel on Stack Overflow See other posts from Stack Overflow or by Daniel
Published on 2010-03-23T19:00:25Z Indexed on 2010/03/23 19:03 UTC
Read the original article Hit count: 140

Filed under:

I want to remove all non-alphanumeric and space characters from a string. So I do want spaces to remain. What do I put for a space in the below function within the [ ] brackets:

ereg_replace("[^A-Za-z0-9]", "", $title);

In other words, what symbol represents space, I know \n represents a new line, is there any such symbol for a single space.

© Stack Overflow or respective owner

Related posts about php