Sanitizing user inputs isn’t fun. It requires writing nasty Regular Expressions (RegEx) or using a ‘find/replace’ like str_replace(). Both RegEx and str_replace() work great, but I want something that’s a bit nicer to look at (and faster too).
I ran in to filter_var() and the parameters that can be used. Filter_var can be used to clean or check an array or a string. Here are a few examples.