Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
I can’t say specifically about magento, but you clearly have substr by utf string there. Replace with mb_substr.
It is best to cut to a space, and as they said above, this is all because of the multibyte encoding.
$text = "Текст который надо обрезать до пробела, очень большой текст бла бла бла";
$text = preg_replace("/^(.{30}[^\,\s]*[\,\s])(.+)$/ui","\\1",$text) ;
echo $text;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question