Did you know that there are a whole set of nifty filtering methods built into PHP? I know it’s crazy to think that the Swiss Army Knife language of the internet would have it’s own built-in filtering system but it does. For instance a common use case would be to sanitize user input prior to using it.
What I mean is perhaps you require a user to enter an email address into a form but let’s face it there are a lot of nefarious types out there who do not wish to play by the rules so they might try entering some arbitrary text or worse attempt to escape a command prompt in the package. Obviously no body wants to hand over their hard working website to some sort of script kiddie so what do you do? You filter the input of course. We’ve all seen code with a function like the following; [Read more…] about Filtering without regex in PHP