댓글 검색 목록

[php] BR -> 새라인으로 변환

페이지 정보

작성자 운영자 작성일 15-05-07 14:58 조회 2,207 댓글 0

BR태그를 새라인으로 변환하는 방법들입니다.

 

1. 

function br2newline( $input ) {

     $out = str_replace( "<br>", "\n", $input );

     $out = str_replace( "<br/>", "\n", $out );

     $out = str_replace( "<br />", "\n", $out );

     $out = str_replace( "<BR>", "\n", $out );

     $out = str_replace( "<BR/>", "\n", $out );

     $out = str_replace( "<BR />", "\n", $out );

     return $out;

 

2.

function br2nl( $input ) {

 return preg_replace('/<br(\s+)?\/?>/i', "\n", $input);

}

 

3.

function _br2nl($input)

{

return str_replace(array(“<br>”, “<BR>”, “<br/>”, “<BR/>”, “<br />”, “<BR />”),”\n”, $input );

 

4. 

function _br2nl($input)

{

return str_replace(array('', '', ''),'\n', strtolower($input) );

}

 

댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.