There is a variable:

$ text = 'Тут строка текста в которой могут быть и цифры'; 

It is necessary to display only those words that have at least 3 characters and place each word between the strong tag. The figures are displayed as is (any number of characters). Punctuation marks do not display.

    1 answer 1

    If you understand everything correctly, then try this:

     $pattern = array('/\b\D{1,2}\b/iu', '/\b\w{3,}|\d+\b/iu', '/\s+/'); $replace = array(' ', '<strong>$0</strong>', ' '); echo preg_filter($pattern, $replace, $text); 

    or so:

     $words = preg_split('/(\b\D{1,2}\b)|\s/iu', $text, -1, PREG_SPLIT_NO_EMPTY); $wrapped = array_map( function ($el) { return '<strong>'.$el.'</strong>'; }, $words ); echo implode(' ', $wrapped); 
    • For sure! Thank you very much, Deonis) Even the class does not allow to deliver) - Ant