PHP заменить n by
$var = str_replace(array("\r\n","\n"),'<br>', $var);
adriendums
$var = str_replace(array("\r\n","\n"),'<br>', $var);
echo str_replace("<br>", " ", $mystringwithbrs);