how can we insert HTML line breaks before all newlines in a string

April 11, 2010 | Filed Under PHP | Comments Off

using nl2br function

nl2br — Inserts HTML line breaks before all newlines in a string

n style="color: #000000;"><?php
style="color: #007700;">echo nl2br("foo isn't\n bar");
?>

The above example will output:

foo isn't<br />
 bar

Comments

Comments are closed.

© PHPInterviewQuestion.com 2009 - 2012

eXTReMe Tracker