nl2br()...
nl2br ― 改行文字の前に HTML の改行タグを挿入する
改行いらん。
function lf2br( $str, $is_xhtml = true ) { $br = $is_xhtml ? '<br />' : '<br>'; return str_replace( array( "\r\n", "\n", "\r" ), $br, $str ); } function br2lf( $str ) { $str = str_replace( array( "\r\n", "\n", "\r" ), '', $str ); return preg_replace( '/<\s*br\s*\/?>/', "\n", $str ); }