[RESOLVED] A long word within a string...
I'm trying to release my website before next Monday and this one thing is bothering me but I don't have time to look into it. In one place, my users can enter a large string, up to 1024 characters in length. This is fine, however I want to limit the character length for a single word so that their entered text doesn't obstruct or change the site layout.
So say I wanted to limit the length of a single word to 20 characters so I place a line break so that the word wraps around rather than stretching the page...
EX:
turn the word
asdfasdfasdfasdfasdfasdfasdfasdfasdf
INTO
asdfasdfasdfasdfasdf<br>asdfasdfasdfasdf
without affecting the rest of the 1024 characters..
How would I go about doing this?
Re: A long word within a string...
$newtext = wordwrap($text, 20, "<br />", true);
http://us2.php.net/wordwrap
Re: A long word within a string...