This code lets you create excerpts, even if they include Unicode characters.
function excerpt(string $input, string $replace = ' ...', int $minLengthWords = 20): string
{
return preg_replace("/((\p{L}+\s){{$minLengthWords}})(.*)/u", '$1' . $replace, $input);
}