I want to replace the special characters by " " it means only alphabetical and numeric characters are supported, this code worked so far!
function clean($string) {
return preg_replace('/[^A-Za-z0-9 ]/', ' ', $string);
}
but now when I try to allow persian (farsi) characters as well, the problem happens which is the $string becomes empty! and when I tried to use other examples given by users for example:
function clean($string) {
return preg_replace('/([^A-Za-z0-9 ])-(^[\x{0600}-\x{06FF}]*$)/', ' ', $string);
}
the file name saves as اذتاتا.
any ideas on how can I solve this?
thank you in advance!