In the previous post, I talked about the reasons using PHP filtering functions is more useful rather than not.
In short, doing so helps to provide a level of validation that’s built into the language so that we don’t have to re-write something. Naturally, there are caveats.
For example, if you’re having to validate a value that is of non-Latin characters, then you’re going to go have to go it alone and implement validation with perhaps a regular expression.
But if you’re using email addresses, URLs, numbers, IP addresses, and so many more things, then you’re in a good position to use something that already exists.
Anyway, all of the above is still about filtering variables. What about inputs, though? That is, those that come from $_POST
or $_GET
. It’s possible to use a similar strategy with a different function and different filter set.
But if you understand the basics presented in the last post, then this post will not be very different.
Continue reading