|
-
May 12th, 2007, 09:39 PM
#1
Thread Starter
Addicted Member
[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?
-
May 12th, 2007, 11:59 PM
#2
Lively Member
Re: A long word within a string...
$newtext = wordwrap($text, 20, "<br />", true);
http://us2.php.net/wordwrap
-
May 13th, 2007, 12:05 AM
#3
Thread Starter
Addicted Member
Re: A long word within a string...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|