title: How to validate text from Summernote - Php
body: <p>I have some questions about how to avoid Xss injection and remove tags:</p>
  
  <p>I'm using sommernote and I want to allow some tags like <code>&lt;br&gt;, &lt;p&gt;, &lt;strong&gt;, etc.</code>. I could use the function strip_tags() but if someone writes the symbol greater (>) or less (&lt;), for instance:</p>
  
  <p>(4 > 5).</p>
  
  <p>This is removed and I want to keep it.</p>
  
  <p>Besides, I need to know the correct length of the text that was entered because I don't want to allow more than N characters, let's say no more than 300 characters. In order to get this I would use strip_tags() but the string is truncated as I mentioned before. How can i do this?</p>
  
  <p>Obviously, I want to avoid XSS injection so I would use <code>htmlentities(strip_tags(string), ENT_QUOTES)</code> to save in DB and when I want to show the content in the main page i would use html_entity_decode(string), is that enough to avoid it?</p>
  
  <p>Thanks in advance</p>