]*>/', '', $valid_html ); $decoded = html_entity_decode( $without_tags, ENT_QUOTES | ENT_HTML5, 'UTF-8' ); return (string) preg_replace( '/\s+/u', ' ', $decoded ); } }