Cleaning up code from HTML, JavaScript and White Space
Compiled a script from different parts of the code, found on the internet, for yourself when counting the number of words in the text. There were some good scripts, but now I don't remember where they are.
Write about your scripts, send yours and if you want, I will make a review for you, or you can write it yourself, and i will check. Good luck with development.
function cleanTextHtml($text){
$search = array ("''si", // Вырезается javascript
"'<[\/\!]*?[^<>]*?>'si", // Вырезаются html-тэги
"'([\rn])[\s]+'", // Вырезается пустое пространство
"'&(quot|#34);'i", // Замещаются html-элементы
"'&(amp|#38);'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'&(nbsp|#160);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i"
);
$replace = array ("",
"",
"\\1",
"\"",
"&",
"<", ">",
" ",
chr(161),
chr(162),
chr(163),
chr(169)
);
$text = preg_replace($search, $replace, $text);
return $text;
}
/*

- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.




