I stand corrected.

Nl2br() is still useful when dealing with outputting data from textarea
form elements... If you're outputting to a browser at least.  But yes,
it only inserts a <br \> where there's a \n, it doesn't replace \n and
doesn't do anything with \r's.

-TG

> -----Original Message-----
> From: John Holmes [mailto:[EMAIL PROTECTED] 
> Sent: Monday, September 13, 2004 3:35 PM
> To: [EMAIL PROTECTED]; M. Sokolewicz
> Subject: Re: [PHP] Convert textarea post data from plain text 
> to html using php..how?
> 
> 
> From: "M. Sokolewicz" <[EMAIL PROTECTED]>
> 
> >> 1. nl2br($posteddata) - This converts all the \r\n's to 
> <br>'s so that
> >> it comes out with the same carriage returns as the person 
> who inputed it
> >> gave it
> > 
> > It doesn't change \r\n to <br>, it only changes \n to <br />
> 
> It doesn't change anything, actually. It just inserts the <br />.
> 
> <?php
> $str = "asdf\nasdf\nasdf\nasdf";
> $n = nl2br($str);
> if(strstr($n,"\n"))
> { echo 'Newlines present'; }
> else
> { echo 'Newlines not present'; }
> ?>
> 
> ---John Holmes...

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

Reply via email to