Two solutions for this:
-
PHP function
nl2br():e.g.,
echo nl2br("This\r\nis\n\ra\nstring\r"); // will output This<br /> is<br /> a<br /> string<br /> -
Wrap the input in
<pre></pre>tags.See: W3C Wiki – HTML/Elements/pre
Two solutions for this:
PHP function nl2br():
e.g.,
echo nl2br("This\r\nis\n\ra\nstring\r");
// will output
This<br />
is<br />
a<br />
string<br />
Wrap the input in <pre></pre> tags.
See: W3C Wiki – HTML/Elements/pre