note 24120 added to function.nl2br

From: Date: Wed, 07 Aug 2002 10:22:14 +0000
Subject: note 24120 added to function.nl2br
Groups: php.notes 
Request: Send a blank email to php-notes+get-34445@lists.php.net to get a copy of this message
The nl2br just put a <br /> tag before the "\n", but does not replace "\n". If you use nl2br function before stroring your string in the data base, and you want to show this text in a textearea for modification for example, don't replace the "<br />" tag with "\n" but simply delete the "<br /> tag the following function do that: function stripbr($str){ $str=eregi_replace('<BR[[:space:]]*/?[[:space:]]*>',"",$str); return $str; } -- http://www.php.net/manual/en/function.nl2br.php http://master.php.net/manage/user-notes.php?action=edit+24120 http://master.php.net/manage/user-notes.php?action=delete+24120 http://master.php.net/manage/user-notes.php?action=reject+24120

« previous php.notes (#34445) next »