Here is the line which will remove all non utf-8 characters from string.
$string = preg_replace('/[^(\x20-\x7F)]*/','', $string);
Here is the line which will remove all non utf-8 characters from string.
$string = preg_replace('/[^(\x20-\x7F)]*/','', $string);