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
"PHP<BR>
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 "PHP<BR>Rocks";

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

Reply via email to