Re: Text file breaking!
| From: | Bobby Patel | Date: | Thu, 05 Jun 2003 00:27:04 +0000 |
| Subject: | Re: Text file breaking! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150285@lists.php.net to get a copy of this message | ||
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" <zavaboy@hotmail.com> wrote in message
news:20030605001211.46386.qmail@pb1.pair.com...
> 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
> zavaboy@hotmail.com
> www.zavaboy.com
>
>