try this
$string = ereg_replace ('\r\n|\n|\r', '<br>', $string);
OR
$string = nl2br($string);

NOTE: for me the first case will remove the newline, whereas the second will
keep them (It might be becuase of my old php version [4.06]?)


"Zavaboy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ok, I don't get it... I put a string to one line ( $string =
> str_replace("\n", "<br>", $string); ) but when I put it in a text file I
see
> breaks right before <br>. For example:
>
> I have a text area and type:
> 1
> 22
> 333
>
> then, I take that string and replace \n with <br>.
> $string = str_replace("\n", "<br>", $string);
>
> then, I put the string in a txt file...
> and here's what I see in the text file:
> 1
> <br>22
> <br>333
>
> instead of:
> 1<br>22<br>333
>
> How can I make it that way?
> Thanks in advance!
>
> --
>
> - Zavaboy
> [EMAIL PROTECTED]
> www.zavaboy.com
>
>



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

Reply via email to