|
Posted by Rik on 08/04/06 12:01
Geoff Berrow wrote:
> Message-ID: <earbtp$66m$2@blue.rahul.net> from axlq contained the
> following:
>
>> That converts line breaks to <br /> which doesn't validate as
>> HTML unless you do str_replace("<br />", "<br>", nl2br($text));
>> And doing that seems inefficient since nl2br() already performs
>> str_replace("\n", "<br />", $text). You may as well do the
>> str_replace yourself and ignore nl2br().
>
> Except that it's not always \n
preg_replace('/(\r\n|\r|\n)/','<br>',$string);
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|