Re: Newline in a guestbook
| From: | Plutarck | Date: | Tue, 24 Apr 2001 22:50:10 +0000 |
| Subject: | Re: Newline in a guestbook | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-50208@lists.php.net to get a copy of this message | ||
You can also use the strlen() function.
--
Plutarck
Should be working on something...
...but forgot what it was.
"Jimmy Bäckström" <broder_b@chello.se> wrote in message
news:000a01c0cd06$351f1060$8f4c59d5@chello.se...
Hey guys!
I'm writing a guestbook with mysql. My probblem is that when user enter at
long word like blablablablablablablablablablablabla my html-tables gets
screwed up. If someone is just fooling around the whole page design can be
destroyed. I want to know how I can make sure that no word is longer than x
characters. If a word should be longer than that, I would like the word
divided into smaller parts with a - character at the end of the first word
like this:
"this is a text in the guestbook.
if there is a really long word
like blablablablablablablabla-
blablabla it is divided into
smaller parts and a - char
is added to the first word."
I thought about reading the whole message into an array, and then loop
through it and for each word check whether it is larger than x chars, and if
so, change it. But couldn't that be a very memory consuming script if it
should do that for every message? Anyone knows how I could do this?