php - Punctate words if it contains more then X number of words -


When a word is elongated, the text corrupts .... How can I fix it?

Example:

Create a word with 4 characters such as "cats" in "ca ..."

How do I do this?

Do you mean that the words are too long, and they increase that column? You can use a regular expression to fix it: perhaps find any consistent string eg Insert 200 non-whitespace characters and a location so that it can break a new line:

preg_replace ('/ (\ s {200}) / gs',' \ 1 ', $ text); Edit: People's question: Similarly,

  $ text = preg_replace ('/ (\ S {200} }) \ S * / gs', '\ 1 ...', $ text);  

Comments