- mb_detect_encoding: documentation ( source)
- preg_replace: documentation ( source)
- iconv: documentation ( source)
<?php
$str = " muito bom parabéns 😤 AND r0_.avaliacao = 'Parabéns 😤' ";
$str_encoding = mb_detect_encoding($str, 'auto');
$str_name = iconv($str_encoding, 'UTF-8', $str);
$str_name = preg_replace('/[^\p{L}\p{N}\s]\w/u', '', $str);
$str_name = preg_replace('/[^A-Za-z0-9\-]/', '', $str);
print($str_name);