Re: Use of substr()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, November 3, 2006 12:33 am, jekillen wrote:
> I am scratching my head over the following:
> I have written code that is supposed to format text
> sent from a form in a textarea form element.
> This text does not have new lines added if
> the text is allowed to automatically wrap to the
> next line. I want to automatically add new lines
> to this input at appropriate locations.

Why in the world would you want to screw up my text by adding newlines?!

Sigh.

Okay, if you insist, just use the PHP builtin function:
http://php.net/wordwrap

> What does the browser actually do when it automatically wraps textarea
> input?

In the bad old days, you had the WRAP attribute, which was largely
abused and misused by people who failed to understand it.

There was really no excuse for anything other than WRAP="virtual" in
the first place.

> What could explain the scrambled result?

Sorry.

I'm not tracing through your code to find the bugs...

You're on the right track printing out the start/end numbers though.

Start with a line of text that is very short and should not wrap.

Then with one long enough to wrap just ONCE.

Build your test suite up from there.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux