this is a simple function to replace all newlines to <br> tags.
\r\n - windows line break
\n - linux line break
\r - mac line break
<?php
function nl_to_br($str) {
return str_replace(array("\r\n","\n","\r"), "<br/>", $str);
}
echo nl_to_br('Hello world\n I am Oyedele Hammed Horlah'); // => Hello World <br> I am Oyedele Hammed Horlah
?>
Enjoy