How to use Transliterator?

There is a need to make the transliteration of the string. Hooked module INTL. And how to use these things miraculously.
Elementary need to translate the line
$str = "Hello";
The documentation and did not understand.
July 8th 19 at 11:39
2 answers
July 8th 19 at 11:41
function slugify($string) {
 $translit = "Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();";
 $string = transliterator_transliterate($translit, $string);
 $string = preg_replace('/[-\s]+/', '-', $string);
 return trim($string, '-');

echo slugify("I love PHP!");

July 8th 19 at 11:43
A simplified version, without the Smoking docks at transliterate:
transliterator_transliterate('Latin-ASCII', transliterator_transliterate('Latin', $sourceString));

Find more questions by tags OOPPHP