note 16394 added to function.nl2br

From: Date: Sat, 27 Oct 2001 20:48:23 +0000
Subject: note 16394 added to function.nl2br
Groups: php.notes 
Request: Send a blank email to php-notes+get-19511@lists.php.net to get a copy of this message
Okay, two notes on the above function I mentioned. I've noticed it always omits one space if the user adds spaces before any text at the beginning of a line. As far as I can tell, you would need to use ereg_replace() to check for that. The only other alternative would be to simply replace all spaces with "&nbsp", which I didn't care to do. So, this works well enough to allow for any formatting users might want to do in the way of adding multiple spaces between text in forms they submit. For instance, many people use two spaces between all of their sentences; HTML normally doesn't reflect this if they submit a form using this convention. -- http://www.php.net/manual/en/function.nl2br.php http://master.php.net/manage/user-notes.php?action=edit+16394 http://master.php.net/manage/user-notes.php?action=delete+16394 http://master.php.net/manage/user-notes.php?action=reject+16394

« previous php.notes (#19511) next »