Remplacement propre des caractères spéciaux en PHP

function filtre($string) {
    $search = array ('@(é|è|ê|ë|Ê|Ë)@','@(á|ã|à|â|ä|Â|Ä)@i','@(ì|í|i|i|î|ï|Î|Ï)@i','@(ú|û|ù|ü|Û|Ü)@i','@(ò|ó|õ|ô|ö|Ô|Ö)@i','@(ñ|Ñ)@i','@(ý|ÿ|Ý)@i','@(ç)@i','@( )@i','@(^a-zA-Z0-9_)@', '@(\'|\.)@');
    $replace = array ('e','a','i','u','o', 'n', 'y', 'c','-','', '');
    $in = preg_replace($search, $replace, $string);
    $in = preg_replace('/([^.a-z0-9]+)/i', '-', $string);
    return strtolower($string);
}