Better way to write some filters and post in PHP
<p>I have a form working and am using strip_tags and htmlentities to try and prevent any malicious code or spam links being submitted by the contact form. Is there a better way to write, that is to combine the following:</p>

<pre><code>$comments = $_POST['comments'] ;
$comments = strip_tags($comments);
$comments = htmlentities($comments);
</code></pre>

<p>I would like to figure out how to write that in one statement if possible. Also, when I have it in the order above, only strip_tags or htmlentities only the one listed first (in the above strip_tags) works. </p>

<p>A final question, is htmlentities or stripslahses better for preventing spammy links being sent in a contact form?</p>

<p>Thank you!</p>
