Share a PHP filter string function with the following code:
function striphtml ($string) {$pattern =array ("' Si '," '
]*?>.*? ') Si ", " ' <[\/\!] *? [^<>]*?> ' si ', ' ' ([\ r \ n]) [\s]+ ' ", " ' & (quot| #34); ' I ", " ' & (amp| #38); ' I ", " ' & (lt| #60); ' I ", " ' & (gt| #62); ' I ", " ' & (nbsp| #160); ' I ", " ' & (iexcl| #161); ' I ", " ' & (cent| #162); ' I ", " ' & (pound| #163); ' I ", " ' & (copy| #169); ' I ", " ' "(\d+); E "); $replace =array (", "," \\1 "," "," & "," < "," > "," ", Chr (161), Chr (162), Chr (163), Chr (169)," Chr (\\1) "); r Eturn preg_replace ($pattern, $replace, $str);}
Articles you may be interested in
- Some of the powerful string handling functions that PHP has forgotten
- PHP's most accurate string-length intercept function
- PHP string substitution function str_replace faster than preg_replace
- String processing function in PHP (string Functions) Full summary
- PHP string Escape function (Addslashes,stripslashes) detailed
- JS array to string, JS string to array method summary
- PHP extracts numbers in a string
- PHP generates consecutive numbers (Letters) array function range () analysis, PHP lottery program function
http://www.bkjia.com/PHPjc/764104.html www.bkjia.com true http://www.bkjia.com/PHPjc/764104.html techarticle Share a PHP filter string function with the following code: function striphtml ($string) {$pattern =array ("' script[^]*?. *?/script ' si ', ' style[^]*? *?/style ' si ', "' [\/\!] *? [^]*?' Si " ...