Below is the code that can be used to remove non ascii character from a string.
$cleanString = preg_replace(‘/[^(\x20-\x7F)]*/’,”, $dirtyString);
But what the hell that code means!
Well, that code uses regular expression to replace every single character that is not in the range of x20 – x7F in ASCII code with an empty character. In other words, [...]