<div style="white-space:pre-line"> function nl2p($s){ $out=''; foreach(explode("\n",$s) as $line) if(trim($line)) $out.='<p>'.$line.'</p>'; return $out; } </div>