note 16391 deleted from function.nl2br by irc-html

From: Date: Thu, 17 Jan 2002 20:01:34 +0000
Subject: note 16391 deleted from function.nl2br by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-24995@lists.php.net to get a copy of this message
Similar to nl2br(), I use the following function to preserve multiple spaces when displaying user-supplied data as HTML. function sp2nbsp ($string) { return str_replace(" ", "  ", $string); } It preserves the right number of spaces in such output by replacing multiple spaces with "&nbsp" codes. It might be a nice addition to the PHP functions to complement nl2br(), if one like this doesn't already exist. I couldn't find one, at least. (Note that there should be two spaces as the first argument to str_replace. You'd be able to see that if this "note" software used something like sp2nbsp(). ;-)

« previous php.notes (#24995) next »