Home > Backend Development > PHP Tutorial > PHP function to filter HTML code spaces, carriage returns and line feeds

PHP function to filter HTML code spaces, carriage returns and line feeds

WBOY
Release: 2016-07-25 09:06:31
Original
1492 people have browsed it
PHP function to filter html code spaces and carriage returns and line feeds ​ ​ ​ ​ ​ ​ ​ ​
                 
                                                                                                                                                                                                                                                                                                       


/**
* PHP function to filter HTML code spaces, carriage returns and line feeds
    * echo deletehtml()
  1. */
  2. function deletehtml($str)
  3. {
  4. $str = trim($str);
  5. $str=strip_tags($str,"");
  6. $str=preg_replace( "{t}","",$str);
  7. $str=preg_replace("{rn}","",$str);
  8. $str=preg_replace("{r}","",$str) ;
  9. $str=preg_replace("{n}","",$str);
  10. $str=preg_replace("{ }","",$str);
  11. return $str;
  12. }
  13. Copy code
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template