Re: text to HTML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, August 26, 2007 9:36 am, Ron Piggott wrote:
>
> Is there a PHP command that turns text into HTML?
>
> EXAMPLE:
>
> "before"
>
> Hi.
>
> How are you doing?
>
> "after"
>
> Hi.<p>
>
> How are you doing?<p>

http://php.net/nl2br

You could also do:
echo "<p>", str_replace("\n", "</p>\n</p>", $text), "</p>\n";

Another option, if the text is more pre-formatted or ASCII-art like,
is to wrap it in <pre></pre> tags -- or style it with CSS as, errr,
whatever, instead of <pre> tags.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux