This cusom PHP function is designed to remove all characters from a given string that are not alpha numeric. This function is based on preg_replace.
Function
function alphaNumeric($string) { return preg_replace("/[^0-9a-zA-Z ]/m", "", $string); }
Calling The Function
$string = 'ABC-220*_R';
Output
ABC220R
Leave A comment
Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *