But there’s more. Let’s run through a few things. Need to remove HTML tags from a string. How about this?
<?php $string = "<p>text</p>"; echo filter_var($string, FILTER_SANITIZE_STRING); ?>
The result is that it will simply echo “text” without the tags.
What we have looked at here are a few examples of what we can do with PHP FILTERS. Of course it is important to validate your code–we ALL know that. But actually doing it is another story. I suppose thart this just gives you, the coder, whether you are a novice or an expert–a way of being sure something is being done to help your code in its journey from bad coding to good coding. May your code be the best that it can be!
Until next time,