title: PHP function to strip tags, except a list of whitelisted tags and attributes
body: <p>I have to strip all HTML tags and attributes from a user input except the ones considered "safe" (ie, a white list approach).</p>
  
  <p><a href="http://php.net/manual/en/function.strip-tags.php" rel="nofollow noreferrer">strip_tags()</a> strips all tags except the ones listed in the <code>$allowable_tags</code> parameter. But I also need to be able to strip all the not whitelisted attributes; for example, I want to allow the <code>&lt;b&gt;</code> tag, but I don't want to allow the <code>onclick</code> attribute for obvious reasons.</p>
  
  <p>Is there a function to do that, or will I have to make my own? </p>