Re: replacing \n with <br>
| From: | David T-G | Date: | Fri, 06 Sep 2002 16:11:54 +0000 |
| Subject: | Re: replacing \n with <br> | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115509@lists.php.net to get a copy of this message | ||
Rob, et al --
..and then Robert Cummings said...
%
% David T-G wrote:
% >
% I've never had problems with doing:
%
% $foo = "I don't like\nnewlines";
%
% $foo = ereg_replace( "\n", '<br />', $foo );
I'm afraid I do. Given my code
$fin = stripslashes(${base64_encode($k)}) ; ###
print "\$fin is .$fin.<BR>\n"; ###
$fout = ereg_replace("\n","<br>",$fin) ;
print "and \$fout is .$fout.<BR>\n"; ###
(ignore the scary base64 stuff :-) I get
$fin is .This is the first line. Here is the second line..
and $fout is .This is the first line.
Here is the second line..
in my browser and
$fin is .This is the first line.
Here is the second line..<BR>
and $fout is .This is the first line.
<br>Here is the second line..<BR>
<br><br>
in my browser's source window. The newlines are still there.
Any thoughts?
%
% Cheers,
% Rob.
Thanks & HAND
:-D
--
David T-G * It's easier to fight for one's principles
(play) davidtg@justpickone.org * than to live up to them. -- fortune cookie
(work) davidtgwork@justpickone.org
http://www.justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!