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


$text = "PHP

Observe the '\n',

When I call the converttohtml function which I wrote ( see bottom )
$html = converttohtml($plaintext);
The $html I'm getting is
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;


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

Reply via email to