RE: [PHP] newline to <p>?

From: Date: Tue, 29 Aug 2000 22:44:37 +0000
Subject: RE: [PHP] newline to <p>?
Groups: php.general 
Request: Send a blank email to php-general+get-14247@lists.php.net to get a copy of this message
> i've tried > $variable = ereg_replace("\n \n","<P>",$variable); > and > $variable = ereg_replace("\n\n","<P>",$variable); > but it doesn't work :( > > if someone can give me a clue what does nl2br function do, > (the code of nl2br) maybe i can solve my problem. If you're wanting to turn two consecutive returns into a <P> in a <TEXTAREA> input, then you may also need to detect \j. What's \j, you ask? PC's end lines in CRLF (or the other way around). Mac's end lines in CR or LF (can't remember which). Amiga's end lines in CR. Unix ends lines in (I think) CR. CR is \n, LF is \j. Or the other way around, I can never remember. But, more important than this, some browsers behave the way some OS's do regardless of the OS they're running on. Older MSIE's send CRLF, for example (send the results of a two-line <TEXTAREA> in a <FORM METHOD=GET> to see what your browser is sending). Have fun, I've probably confused you now :) Jason

« previous php.general (#14247) next »