Created
November 27, 2012 15:58
-
-
Save keithmorris/4155049 to your computer and use it in GitHub Desktop.
Strip non alphanumeric characters from a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Found here: | |
http://www.emanueleferonato.com/2006/07/27/strip-non-alphanumeric-characters-from-a-string-with-php/ | |
*/ | |
$string_to_be_stripped = "Hi, I am a string and I need to be stripped..."; | |
$new_string = ereg_replace("[^A-Za-z0-9]", "", $string_to_be_stripped ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment