Dreamhost

Looking for somewhere to host your site? Browse our PHP web hosts section!

Home > Code Snippets > Remove all characters except letters and numbers from a string

Remove all characters except letters and numbers from a string

Description

If you want to strip a string of all symbols and characters other than alphanumeric letters and numbers then use this. It will take a string and erase / delete any non-alphanumeric characters, and then output a clean version without the unwanted characters.

The code

There was a problem whilst attempting to load the source code.


Deprecated: Function eregi_replace() is deprecated in /home/totallyphpuk/totallyphp.co.uk/functions/function.syntaxHighlight.php on line 29

Deprecated: Function eregi_replace() is deprecated in /home/totallyphpuk/totallyphp.co.uk/functions/function.syntaxHighlight.php on line 30

Get the code

Download the file to your computer: Click here to get the file