This article shares a small piece of code with you. It mainly shares with you how to remove all tags, spaces and blanks in Html with PHP. I hope it can help you.
function cutstr_html($string, $sublen){ $string = strip_tags($string); $string = trim($string); $string = ereg_replace("\t","",$string); $string = ereg_replace("\r\n","",$string); $string = ereg_replace("\r","",$string); $string = ereg_replace("\n","",$string); $string = ereg_replace(" ","",$string); return trim($string); }
Related recommendations:
php removes html tags Function - strip_tags and htmlspecialchars
The above is the detailed content of How to remove all tags, spaces and whitespace from Html with PHP. For more information, please follow other related articles on the PHP Chinese website!