Hi, all --
I have a php script which writes comments out to a file in the format
field@@comment
field@@comment
...
and everything has worked delightfully -- until someone put in a newline
in one of the items and now we have
field@@com
ment
field@@comment
...
and things break.
David T-G wrote:
I've never had problems with doing:
$foo = I don't like\nnewlines;
$foo = ereg_replace( \n, 'br /', $foo );
Cheers,
Rob.
Hi, all --
I have a php script which writes comments out to a file in the format
field@@comment
field@@comment
...
and
Bothe of us got the same problem at same time :-)
- Original Message -
From: David T-G [EMAIL PROTECTED]
To: PHP General list [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 9:28 PM
Subject: [PHP] replacing \n with br
--
PHP General Mailing List (http://www.php.net
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)}) ;
Actually on second thought... and I don't know why I went with the
crowd in the first place... I do the following:
$foo = I don't like\nnewlines;
$foo = str_replace( \n, 'br /', $foo );
That one work for you? It's more efficient too.
Cheers,
Rob.
David T-G wrote:
Rob, et al --
Rob, et al --
...and then Robert Cummings said...
%
% Actually on second thought... and I don't know why I went with the
*grin*
% crowd in the first place... I do the following:
%
% $foo = I don't like\nnewlines;
%
% $foo = str_replace( \n, 'br /', $foo );
%
% That one work for
David T-G wrote:
Rob, et al --
...and then Robert Cummings said...
%
% Actually on second thought... and I don't know why I went with the
*grin*
% crowd in the first place... I do the following:
%
% $foo = I don't like\nnewlines;
%
% $foo = str_replace( \n, 'br /', $foo
Why not just use the nl2br() function? It's a lot easier that using any
replace function you build yourself.
On Friday, September 6, 2002, at 11:58 AM, David T-G wrote:
Hi, all --
I have a php script which writes comments out to a file in the format
field@@comment
field@@comment
I'm sorry, I missed the first part of this thread so am only going by its
subject line mostly... But, I assume you are all aware of the nl2br function
and there's a special reason it does not apply here but I thought I'd
mention it any way... Just in case... :)
-B
--
PHP General Mailing List
Rob, et al --
...and then Robert Cummings said...
%
% David T-G wrote:
%
% ...and then Robert Cummings said...
% %
...
% % $foo = str_replace( \n, 'br /', $foo );
% %
% % That one work for you? It's more efficient too.
%
% Actually, no. I thought about listing all of the things I
Brent, et al --
...and then Brent Baisley said...
%
% Why not just use the nl2br() function? It's a lot easier that using any
Because it doesn't do what I need. From the Fine Manual:
nl2br -- Inserts HTML line breaks before all newlines in a string
string nl2br ( string string)
Brian --
...and then Brian V Bonini said...
%
% I'm sorry, I missed the first part of this thread so am only going by its
% subject line mostly... But, I assume you are all aware of the nl2br function
Well, only sorta; I said replace in there, you may notice.
% and there's a special reason
Sorry. Since you were looking to use br, I thought you were creating
HTML content. But then, line feeds are ignored in HTML so then you
wouldn't have a problem with them. I should have thought of that.
How are you reading the file? The key being that you said you read it
line by line. Once
Brent --
...and then Brent Baisley said...
%
% Sorry. Since you were looking to use br, I thought you were creating
% HTML content. But then, line feeds are ignored in HTML so then you
Well, yes and no.
% wouldn't have a problem with them. I should have thought of that.
Well, yes and no
David T-G wrote:
Brent --
The data file format is
field@@data
field@@data
...
and a real example is
comment@@this is a comment
latdir@@N
londir@@W
latdec@@36
londec@@89
...
and my code [now, after mods,] looks like
...
if (
15 matches
Mail list logo