note 19087 added to function.nl2br
| From: | yann_cochard at yahoo dot fr | Date: | Fri, 15 Feb 2002 12:41:42 +0000 |
| Subject: | note 19087 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26639@lists.php.net to get a copy of this message | ||
php@fendforyourself.com wrote :
> Someone asked why there was no br2nl(). I think it's probably in most
> cases you want to take your data and display it in HTML, so it is probably
> already stored with the \n. Storing it with the BR's instead would just
> take up extra space and there's no point in doing that when you can always
> convert it on display.
A br2nl could be of use : if you want to allow a visitor to modify a data stored in the database,
you display this data in a textarea. Showing BR's is quite ugly, a br2nl would then be
convenient. However it would be client-OS dependant, so more difficult to set up.
I prefer to convert before storing, even if it takes more space, because in the other case I would
have to convert it for EACH display. So I lose on the space side, but I win on the speed one. For my
hosting, hard drive capacity is cheaper than CPU.
Just my 2 (euro)cents. ;-)
Yann
--
http://www.php.net/manual/en/function.nl2br.php
http://master.php.net/manage/user-notes.php?action=edit+19087
http://master.php.net/manage/user-notes.php?action=delete+19087
http://master.php.net/manage/user-notes.php?action=reject+19087