How to remove non utf-8 characters from string in php

Here is the line which will remove all non utf-8 characters from string.

$string = preg_replace('/[^(\x20-\x7F)]*/','', $string);