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