Using PHP substr() and strip_tags() while retaining formatting and without breaking HTML

Not amazing, but works. function html_cut($text, $max_length) { $tags = array(); $result = “”; $is_open = false; $grab_open = false; $is_close = false; $in_double_quotes = false; $in_single_quotes = false; $tag = “”; $i = 0; $stripped = 0; $stripped_text = strip_tags($text); while ($i < strlen($text) && $stripped < strlen($stripped_text) && $stripped < $max_length) { $symbol … Read more

php substr() function with utf-8 leaves � marks at the end

The comments above are correct so long as you have mbstring enabled on your server. $var = “Бензин Офиси А.С. также производит все типы жира и смазок и их побочных продуктов в его смесительных установках нефти машинного масла в Деринце, Измите, Алиага и Измире. У Компании есть 3 885 станций технического обслуживания, включая сжиженный газ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)