You can also use the strlen() function.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Jimmy Bäckström" <[EMAIL PROTECTED]> wrote in message
000a01c0cd06$351f1060$[EMAIL PROTECTED]">news:000a01c0cd06$351f1060$[EMAIL PROTECTED]...
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?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to