PHP remove non alphanumeric characters
PHP remove non alphanumeric characters
Non-Alpha numeric characters are any which is not A-Z,a-z or 0-9
A classic example of Non-Alphanumeric characters are !ӣ$%^&*(), Here we will see how to remove Non-Alphanumeric characters using php.
THE CODE
< ?php $str = "Here! are some numbers 1244 and some non alphanumeric characters !£$%^&"; $new_string = preg_replace("/[^a-zA-Z0-9\s]/", "", $str); echo $new_string; ?>
This is a very simple script which remove ! and other characters from the string !£$%^&