79450622

Date: 2025-02-19 08:06:58
Score: 0.5
Natty:
Report link

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);
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Mahdi Hasanpour