Use PHP's native Filter and Validation functions!
This should be obvious, but there is a lot of people out there that still ignore this, either because they don't know it exists (the very reason why I'm writing this) or because they insist in creating their own code<sup>1</sup>.
Since PHP 5.2.0 (released in 2006!) the language has a native "family" of functions to deal with the extremely difficult job of validating and filtering data:
http://php.net/manual/en/book.filter.php
(1) I'm all for reinventing the wheel (under certain conditions), but people often do it wrong when it comes to security.
Written by Er Galvão Abbott
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#