Re: [PHP] \n to BR Problem

2002-09-09 Thread yasin inat

try   this   function 

nltobr()



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




Re: [PHP] \n to BR Problem

2002-09-07 Thread Justin French

on 07/09/02 1:51 AM, N. Pari Purna Chand ([EMAIL PROTECTED])
wrote:

 $newstr = ereg_replace (\n, BR, $newstr);

Instead, I think you'd have to escape the slash: \\n... but it's
irrelevant, because there's a function that does this for you:

$newstr = nl2br($newstr);


Also, you should try to use str_replace('was', 'is', $str), because it's
less resource intensive than ereg*


Justin


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




[PHP] \n to BR Problem

2002-09-06 Thread N. Pari Purna Chand

I have a small problem in converting a plain text to html.

say 

$text = PHP
Rocks;

Observe the '\n',

When I call the converttohtml function which I wrote ( see bottom )
$html = converttohtml($plaintext);
The $html I'm getting is
PHPBR
Rocks;
Observe the '\n' still exists,

What is the way to make the 'converttohtml' function return
a plain string with out any '\n'.
The out put I'm looking for is PHPBRRocks;

function converttohtml($plaintext) {
$newstr = htmlentities($plaintext);
$newstr = ereg_replace (\n, BR, $newstr);
$newstr = ereg_replace ( , nbsp;, $newstr);
return $newstr;
}

/Chandu


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




Re: [PHP] \n to BR Problem

2002-09-06 Thread David T-G

Chandu, et al --

...and then N. Pari Purna Chand said...
% 
% I have a small problem in converting a plain text to html.

Son of a gun...  Maybe it's world consciousness working on this :-)

I've just posted a similar question.  Be sure to watch both threads just
in case.


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg78073/pgp0.pgp
Description: PGP signature


Re: [PHP] \n to BR Problem

2002-09-06 Thread Jacob Miller

At 23:51 09/06/2002, you wrote:
I have a small problem in converting a plain text to html.

snip

$newstr = ereg_replace (\n, BR, $newstr);

try

$newstr = ereg_replace(\n\r|\n|\r, BR, $newstr);

notice it looks for all types of line feeds

-jacob


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




Re: [PHP] \n to BR Problem

2002-09-06 Thread Jacob Miller

At 23:51 09/06/2002, you wrote:
I have a small problem in converting a plain text to html.

snip

$newstr = ereg_replace (\n, BR, $newstr);

try

$newstr = ereg_replace(\n\r|\n|\r, BR, $newstr);

notice it looks for all types of line feeds

-jacob


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