Last Updated: February 25, 2016
·
334
· galvao

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.