php - Auto spacebar after a word with over 50 characters
Is there a function that can automatically add a spacerbar if a word is over a certain number of characters? For example, given a word with 100 characters, it will post a spacebar at the 50th character. I am creating a comment system, and if someone posts something like:
ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF
it will mess up the look of my layout because there is no space in the word.
Answer
Solution:
Use CSS instead of changing the actual word/string:
Demo
Answer
Solution:
To answer with PHP, you can use a function like this one (if you really need to):