\n to <BR> Problem

From: Date: Fri, 06 Sep 2002 15:51:33 +0000
Subject: \n to <BR> Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-115501@lists.php.net to get a copy of this message
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

« previous php.general (#115501) next »